diff options
author | Lunny Xiao <xiaolunwen@gmail.com> | 2021-01-15 04:27:22 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-01-14 21:27:22 +0100 |
commit | 60a3297a33b2209ae7acf6fd84afd62e095e01aa (patch) | |
tree | 641587633e7443f02ff666c02f2b2a640634ba46 /routers/admin/users.go | |
parent | f76c30094f086162d09926a95e9a75c91177a674 (diff) | |
download | gitea-60a3297a33b2209ae7acf6fd84afd62e095e01aa.tar.gz gitea-60a3297a33b2209ae7acf6fd84afd62e095e01aa.zip |
Use ServerError provided by Context (#14333)
... instead of InternalServerError by macaron
Diffstat (limited to 'routers/admin/users.go')
-rw-r--r-- | routers/admin/users.go | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/routers/admin/users.go b/routers/admin/users.go index 9fe5c3ef7d..74fce9a10c 100644 --- a/routers/admin/users.go +++ b/routers/admin/users.go @@ -188,7 +188,7 @@ func prepareUserInfo(ctx *context.Context) *models.User { _, err = models.GetTwoFactorByUID(u.ID) if err != nil { if !models.IsErrTwoFactorNotEnrolled(err) { - ctx.InternalServerError(err) + ctx.ServerError("IsErrTwoFactorNotEnrolled", err) return nil } ctx.Data["TwoFactorEnabled"] = false @@ -268,7 +268,7 @@ func EditUserPost(ctx *context.Context, form auth.AdminEditUserForm) { return } if err = u.SetPassword(form.Password); err != nil { - ctx.InternalServerError(err) + ctx.ServerError("SetPassword", err) return } } @@ -285,12 +285,12 @@ func EditUserPost(ctx *context.Context, form auth.AdminEditUserForm) { if form.Reset2FA { tf, err := models.GetTwoFactorByUID(u.ID) if err != nil && !models.IsErrTwoFactorNotEnrolled(err) { - ctx.InternalServerError(err) + ctx.ServerError("GetTwoFactorByUID", err) return } if err = models.DeleteTwoFactorByID(tf.ID, u.ID); err != nil { - ctx.InternalServerError(err) + ctx.ServerError("DeleteTwoFactorByID", err) return } } |