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:
kolaente 2026-04-20 19:40:23 +02:00 committed by kolaente
parent e8b777d3be
commit d64ca0c777
1 changed files with 9 additions and 0 deletions

View File

@ -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