fix(admin): reload created user before returning in admin create handler
The admin create-user handler returned the in-memory newUser struct directly. On mail-enabled instances with skip_email_confirm=false, user.CreateUser persists the account as email-confirmation-required, but the returned struct still reflects the pre-persist status, so the admin API reported a misleading active status immediately after creation.
This commit is contained in:
parent
e8b777d3be
commit
d64ca0c777
|
|
@ -103,6 +103,15 @@ func CreateUser(c *echo.Context) error {
|
|||
return err
|
||||
}
|
||||
|
||||
// Reload the user so the returned status reflects what was actually persisted
|
||||
// (e.g. StatusEmailConfirmationRequired on mail-enabled instances).
|
||||
rs := db.NewSession()
|
||||
defer rs.Close()
|
||||
newUser, err = user.GetUserByID(rs, newUser.ID)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
providers, err := openid.GetAllProviders()
|
||||
if err != nil {
|
||||
return err
|
||||
|
|
|
|||
Loading…
Reference in New Issue