Merge pull request #291 from gima/dev
Make possible for administrators to change user's password (fix proposal...
This commit is contained in:
commit
aab2dbc505
3 changed files with 15 additions and 0 deletions
|
@ -16,6 +16,7 @@ import (
|
||||||
|
|
||||||
type AdminEditUserForm struct {
|
type AdminEditUserForm struct {
|
||||||
Email string `form:"email" binding:"Required;Email;MaxSize(50)"`
|
Email string `form:"email" binding:"Required;Email;MaxSize(50)"`
|
||||||
|
Passwd string `form:"passwd"`
|
||||||
Website string `form:"website" binding:"MaxSize(50)"`
|
Website string `form:"website" binding:"MaxSize(50)"`
|
||||||
Location string `form:"location" binding:"MaxSize(50)"`
|
Location string `form:"location" binding:"MaxSize(50)"`
|
||||||
Avatar string `form:"avatar" binding:"Required;Email;MaxSize(50)"`
|
Avatar string `form:"avatar" binding:"Required;Email;MaxSize(50)"`
|
||||||
|
|
|
@ -134,6 +134,13 @@ func EditUserPost(ctx *middleware.Context, params martini.Params, form auth.Admi
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (form.Passwd != "") {
|
||||||
|
u.Passwd = form.Passwd
|
||||||
|
u.Rands = models.GetUserSalt()
|
||||||
|
u.Salt = models.GetUserSalt()
|
||||||
|
u.EncodePasswd()
|
||||||
|
}
|
||||||
|
|
||||||
u.Email = form.Email
|
u.Email = form.Email
|
||||||
u.Website = form.Website
|
u.Website = form.Website
|
||||||
u.Location = form.Location
|
u.Location = form.Location
|
||||||
|
|
|
@ -45,6 +45,13 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="col-md-3 control-label">Password</label>
|
||||||
|
<div class="col-md-7">
|
||||||
|
<input name="passwd" type="password" class="form-control" placeholder="Type account's new password or leave unfilled">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label class="col-md-3 control-label">Website</label>
|
<label class="col-md-3 control-label">Website</label>
|
||||||
<div class="col-md-7">
|
<div class="col-md-7">
|
||||||
|
|
Loading…
Reference in a new issue