summaryrefslogtreecommitdiffstats
path: root/routers
diff options
context:
space:
mode:
authorZettat123 <zettat123@gmail.com>2024-03-05 13:55:47 +0800
committerGitHub <noreply@github.com>2024-03-05 05:55:47 +0000
commit4fd9c56ed09b31e2f6164a5f534a31c6624d0478 (patch)
treeb567b91deed03bb221498fc08270a5d456dae780 /routers
parent7e8c1c5ba18e1ac8861f429b825163b8210fd178 (diff)
downloadgitea-4fd9c56ed09b31e2f6164a5f534a31c6624d0478.tar.gz
gitea-4fd9c56ed09b31e2f6164a5f534a31c6624d0478.zip
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`.
Diffstat (limited to 'routers')
-rw-r--r--routers/api/v1/admin/user.go2
-rw-r--r--routers/web/admin/users.go2
2 files changed, 2 insertions, 2 deletions
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