Browse Source

Merge pull request #1244 from jamesa/develop

Add full name field to admin's user edit page (fixes #1130)
pull/1393/head
无闻 10 years ago
parent
commit
91ab2538c3
  1. 1
      modules/auth/admin.go
  2. 1
      routers/admin/users.go
  3. 4
      templates/admin/user/edit.tmpl

1
modules/auth/admin.go

@ -11,6 +11,7 @@ import (
) )
type AdminEditUserForm struct { type AdminEditUserForm struct {
FullName string `form:"fullname" binding:"MaxSize(100)"`
Email string `binding:"Required;Email;MaxSize(50)"` Email string `binding:"Required;Email;MaxSize(50)"`
Password string `binding:"OmitEmpty;MinSize(6);MaxSize(255)"` Password string `binding:"OmitEmpty;MinSize(6);MaxSize(255)"`
Website string `binding:"MaxSize(50)"` Website string `binding:"MaxSize(50)"`

1
routers/admin/users.go

@ -185,6 +185,7 @@ func EditUserPost(ctx *middleware.Context, form auth.AdminEditUserForm) {
u.EncodePasswd() u.EncodePasswd()
} }
u.FullName = form.FullName
u.Email = form.Email u.Email = form.Email
u.Website = form.Website u.Website = form.Website
u.Location = form.Location u.Location = form.Location

4
templates/admin/user/edit.tmpl

@ -32,6 +32,10 @@
<label>{{.i18n.Tr "username"}}</label> <label>{{.i18n.Tr "username"}}</label>
<label class="text-left">{{.User.Name}}</label> <label class="text-left">{{.User.Name}}</label>
</div> </div>
<div class="field">
<label for="full-name">{{.i18n.Tr "settings.full_name"}}</label>
<input class="ipt ipt-large ipt-radius {{if .Err_FullName}}ipt-error{{end}}" id="full-name" name="fullname" type="text" value="{{.User.FullName}}" />
</div>
<div class="field"> <div class="field">
<label class="req" for="email">{{.i18n.Tr "email"}}</label> <label class="req" for="email">{{.i18n.Tr "email"}}</label>
<input class="ipt ipt-large ipt-radius {{if .Err_Email}}ipt-error{{end}}" id="email" name="email" type="email" value="{{.User.Email}}" required/> <input class="ipt ipt-large ipt-radius {{if .Err_Email}}ipt-error{{end}}" id="email" name="email" type="email" value="{{.User.Email}}" required/>

Loading…
Cancel
Save