From 4fd9c56ed09b31e2f6164a5f534a31c6624d0478 Mon Sep 17 00:00:00 2001 From: Zettat123 Date: Tue, 5 Mar 2024 13:55:47 +0800 Subject: Skip email domain check when admin users adds user manually (#29522) Fix #27457 Administrators should be able to manually create any user even if the user's email address is not in `EMAIL_DOMAIN_ALLOWLIST`. --- routers/api/v1/admin/user.go | 2 +- routers/web/admin/users.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'routers') diff --git a/routers/api/v1/admin/user.go b/routers/api/v1/admin/user.go index 64315108b0..7f4200f684 100644 --- a/routers/api/v1/admin/user.go +++ b/routers/api/v1/admin/user.go @@ -133,7 +133,7 @@ func CreateUser(ctx *context.APIContext) { u.UpdatedUnix = u.CreatedUnix } - if err := user_model.CreateUser(ctx, u, overwriteDefault); err != nil { + if err := user_model.AdminCreateUser(ctx, u, overwriteDefault); err != nil { if user_model.IsErrUserAlreadyExist(err) || user_model.IsErrEmailAlreadyUsed(err) || db.IsErrNameReserved(err) || diff --git a/routers/web/admin/users.go b/routers/web/admin/users.go index a34e0d0f0d..dfb103c8ab 100644 --- a/routers/web/admin/users.go +++ b/routers/web/admin/users.go @@ -177,7 +177,7 @@ func NewUserPost(ctx *context.Context) { u.MustChangePassword = form.MustChangePassword } - if err := user_model.CreateUser(ctx, u, overwriteDefault); err != nil { + if err := user_model.AdminCreateUser(ctx, u, overwriteDefault); err != nil { switch { case user_model.IsErrUserAlreadyExist(err): ctx.Data["Err_UserName"] = true -- cgit v1.2.3