diff options
Diffstat (limited to 'routers/web/admin/users.go')
-rw-r--r-- | routers/web/admin/users.go | 44 |
1 files changed, 22 insertions, 22 deletions
diff --git a/routers/web/admin/users.go b/routers/web/admin/users.go index 044efa0099..5cb25d8672 100644 --- a/routers/web/admin/users.go +++ b/routers/web/admin/users.go @@ -12,8 +12,8 @@ import ( "strings" "code.gitea.io/gitea/models" + "code.gitea.io/gitea/models/auth" "code.gitea.io/gitea/models/db" - "code.gitea.io/gitea/models/login" user_model "code.gitea.io/gitea/models/user" "code.gitea.io/gitea/modules/base" "code.gitea.io/gitea/modules/context" @@ -81,9 +81,9 @@ func NewUser(ctx *context.Context) { ctx.Data["login_type"] = "0-0" - sources, err := login.Sources() + sources, err := auth.Sources() if err != nil { - ctx.ServerError("login.Sources", err) + ctx.ServerError("auth.Sources", err) return } ctx.Data["Sources"] = sources @@ -100,9 +100,9 @@ func NewUserPost(ctx *context.Context) { ctx.Data["PageIsAdminUsers"] = true ctx.Data["DefaultUserVisibilityMode"] = setting.Service.DefaultUserVisibilityMode - sources, err := login.Sources() + sources, err := auth.Sources() if err != nil { - ctx.ServerError("login.Sources", err) + ctx.ServerError("auth.Sources", err) return } ctx.Data["Sources"] = sources @@ -119,19 +119,19 @@ func NewUserPost(ctx *context.Context) { Email: form.Email, Passwd: form.Password, IsActive: true, - LoginType: login.Plain, + LoginType: auth.Plain, } if len(form.LoginType) > 0 { fields := strings.Split(form.LoginType, "-") if len(fields) == 2 { lType, _ := strconv.ParseInt(fields[0], 10, 0) - u.LoginType = login.Type(lType) + u.LoginType = auth.Type(lType) u.LoginSource, _ = strconv.ParseInt(fields[1], 10, 64) u.LoginName = form.LoginName } } - if u.LoginType == login.NoType || u.LoginType == login.Plain { + if u.LoginType == auth.NoType || u.LoginType == auth.Plain { if len(form.Password) < setting.MinPasswordLength { ctx.Data["Err_Password"] = true ctx.RenderWithErr(ctx.Tr("auth.password_too_short", setting.MinPasswordLength), tplUserNew, &form) @@ -201,26 +201,26 @@ func prepareUserInfo(ctx *context.Context) *user_model.User { ctx.Data["User"] = u if u.LoginSource > 0 { - ctx.Data["LoginSource"], err = login.GetSourceByID(u.LoginSource) + ctx.Data["LoginSource"], err = auth.GetSourceByID(u.LoginSource) if err != nil { - ctx.ServerError("login.GetSourceByID", err) + ctx.ServerError("auth.GetSourceByID", err) return nil } } else { - ctx.Data["LoginSource"] = &login.Source{} + ctx.Data["LoginSource"] = &auth.Source{} } - sources, err := login.Sources() + sources, err := auth.Sources() if err != nil { - ctx.ServerError("login.Sources", err) + ctx.ServerError("auth.Sources", err) return nil } ctx.Data["Sources"] = sources ctx.Data["TwoFactorEnabled"] = true - _, err = login.GetTwoFactorByUID(u.ID) + _, err = auth.GetTwoFactorByUID(u.ID) if err != nil { - if !login.IsErrTwoFactorNotEnrolled(err) { + if !auth.IsErrTwoFactorNotEnrolled(err) { ctx.ServerError("IsErrTwoFactorNotEnrolled", err) return nil } @@ -268,11 +268,11 @@ func EditUserPost(ctx *context.Context) { fields := strings.Split(form.LoginType, "-") if len(fields) == 2 { loginType, _ := strconv.ParseInt(fields[0], 10, 0) - loginSource, _ := strconv.ParseInt(fields[1], 10, 64) + authSource, _ := strconv.ParseInt(fields[1], 10, 64) - if u.LoginSource != loginSource { - u.LoginSource = loginSource - u.LoginType = login.Type(loginType) + if u.LoginSource != authSource { + u.LoginSource = authSource + u.LoginType = auth.Type(loginType) } } @@ -325,13 +325,13 @@ func EditUserPost(ctx *context.Context) { } if form.Reset2FA { - tf, err := login.GetTwoFactorByUID(u.ID) - if err != nil && !login.IsErrTwoFactorNotEnrolled(err) { + tf, err := auth.GetTwoFactorByUID(u.ID) + if err != nil && !auth.IsErrTwoFactorNotEnrolled(err) { ctx.ServerError("GetTwoFactorByUID", err) return } - if err = login.DeleteTwoFactorByID(tf.ID, u.ID); err != nil { + if err = auth.DeleteTwoFactorByID(tf.ID, u.ID); err != nil { ctx.ServerError("DeleteTwoFactorByID", err) return } |