summaryrefslogtreecommitdiffstats
path: root/routers/admin/users.go
diff options
context:
space:
mode:
authorUnknwon <u@gogs.io>2015-03-17 03:21:58 -0400
committerUnknwon <u@gogs.io>2015-03-17 03:21:58 -0400
commit33894591a6d391674e938d018801d88d0011f0b7 (patch)
treef487e0bbb63c8a808d5a0f82751e23d379d57d3f /routers/admin/users.go
parent35c83f60266fb2178ae69db4b578dad333b6b2ea (diff)
downloadgitea-33894591a6d391674e938d018801d88d0011f0b7.tar.gz
gitea-33894591a6d391674e938d018801d88d0011f0b7.zip
#851: Edit Account does not take into consideration password rules
Diffstat (limited to 'routers/admin/users.go')
-rw-r--r--routers/admin/users.go7
1 files changed, 3 insertions, 4 deletions
diff --git a/routers/admin/users.go b/routers/admin/users.go
index 2bbf13b92d..4f57407a2a 100644
--- a/routers/admin/users.go
+++ b/routers/admin/users.go
@@ -168,6 +168,7 @@ func EditUserPost(ctx *middleware.Context, form auth.AdminEditUserForm) {
ctx.Handle(500, "GetUserById", err)
return
}
+ ctx.Data["User"] = u
if ctx.HasError() {
ctx.HTML(200, USER_EDIT)
@@ -175,8 +176,8 @@ func EditUserPost(ctx *middleware.Context, form auth.AdminEditUserForm) {
}
// FIXME: need password length check
- if len(form.Passwd) > 0 {
- u.Passwd = form.Passwd
+ if len(form.Password) > 0 {
+ u.Passwd = form.Password
u.Salt = models.GetUserSalt()
u.EncodePasswd()
}
@@ -193,8 +194,6 @@ func EditUserPost(ctx *middleware.Context, form auth.AdminEditUserForm) {
u.IsAdmin = form.Admin
u.AllowGitHook = form.AllowGitHook
- ctx.Data["User"] = u
-
if err := models.UpdateUser(u); err != nil {
if err == models.ErrEmailAlreadyUsed {
ctx.Data["Err_Email"] = true