diff --git a/modules/auth/admin.go b/modules/auth/admin.go index 668afd9a35..69161f908a 100644 --- a/modules/auth/admin.go +++ b/modules/auth/admin.go @@ -16,6 +16,7 @@ import ( type AdminEditUserForm struct { Email string `form:"email" binding:"Required;Email;MaxSize(50)"` + Passwd string `form:"passwd"` Website string `form:"website" binding:"MaxSize(50)"` Location string `form:"location" binding:"MaxSize(50)"` Avatar string `form:"avatar" binding:"Required;Email;MaxSize(50)"` diff --git a/routers/admin/user.go b/routers/admin/user.go index cf99db2bf7..2d22cfdd89 100644 --- a/routers/admin/user.go +++ b/routers/admin/user.go @@ -134,6 +134,13 @@ func EditUserPost(ctx *middleware.Context, params martini.Params, form auth.Admi return } + if (form.Passwd != "") { + u.Passwd = form.Passwd + u.Rands = models.GetUserSalt() + u.Salt = models.GetUserSalt() + u.EncodePasswd() + } + u.Email = form.Email u.Website = form.Website u.Location = form.Location diff --git a/templates/admin/user/edit.tmpl b/templates/admin/user/edit.tmpl index 329c667318..aab1aaf193 100644 --- a/templates/admin/user/edit.tmpl +++ b/templates/admin/user/edit.tmpl @@ -45,6 +45,13 @@ +
+ +
+ +
+
+