Browse Source

Merge pull request 'admin_desc_edit' (#71) from admin_desc_edit into dev_mirocod

Reviewed-on: http://git.mirocod.ru/MIROCOD/Platform_Mirocod/pulls/71
tree_zoom
parent
commit
909ce74308
  1. 20
      models/user/user.go
  2. 1
      routers/web/admin/users.go
  3. 1
      services/forms/admin.go
  4. 4
      templates/admin/user/edit.tmpl

20
models/user/user.go

@ -89,17 +89,17 @@ type User struct {
// is to change his/her password after registration. // is to change his/her password after registration.
MustChangePassword bool `xorm:"NOT NULL DEFAULT false"` MustChangePassword bool `xorm:"NOT NULL DEFAULT false"`
LoginType auth.Type LoginType auth.Type
LoginSource int64 `xorm:"NOT NULL DEFAULT 0"` LoginSource int64 `xorm:"NOT NULL DEFAULT 0"`
LoginName string LoginName string
Type UserType Type UserType
Location string Location string
LocationCoordinate string LocationCoordinate string
Website string Website string
Rands string `xorm:"VARCHAR(32)"` Rands string `xorm:"VARCHAR(32)"`
Salt string `xorm:"VARCHAR(32)"` Salt string `xorm:"VARCHAR(32)"`
Language string `xorm:"VARCHAR(5)"` Language string `xorm:"VARCHAR(5)"`
Description string Description string `xorm:"TEXT"`
CreatedUnix timeutil.TimeStamp `xorm:"INDEX created"` CreatedUnix timeutil.TimeStamp `xorm:"INDEX created"`
UpdatedUnix timeutil.TimeStamp `xorm:"INDEX updated"` UpdatedUnix timeutil.TimeStamp `xorm:"INDEX updated"`

1
routers/web/admin/users.go

@ -371,6 +371,7 @@ func EditUserPost(ctx *context.Context) {
emailChanged := !strings.EqualFold(u.Email, form.Email) emailChanged := !strings.EqualFold(u.Email, form.Email)
u.Email = form.Email u.Email = form.Email
u.Website = form.Website u.Website = form.Website
u.Description = form.Description
u.Location = form.Location u.Location = form.Location
u.LocationCoordinate = form.LocationCoordinate u.LocationCoordinate = form.LocationCoordinate
u.MaxRepoCreation = form.MaxRepoCreation u.MaxRepoCreation = form.MaxRepoCreation

1
services/forms/admin.go

@ -41,6 +41,7 @@ type AdminEditUserForm struct {
Email string `binding:"Required;Email;MaxSize(254)"` Email string `binding:"Required;Email;MaxSize(254)"`
Password string `binding:"MaxSize(255)"` Password string `binding:"MaxSize(255)"`
Website string `binding:"ValidUrl;MaxSize(255)"` Website string `binding:"ValidUrl;MaxSize(255)"`
Description string `binding:"MaxSize(1024)"`
Location string `binding:"MaxSize(50)"` Location string `binding:"MaxSize(50)"`
LocationCoordinate string `binding:"MaxSize(255)"` LocationCoordinate string `binding:"MaxSize(255)"`
MaxRepoCreation int MaxRepoCreation int

4
templates/admin/user/edit.tmpl

@ -73,6 +73,10 @@
<input id="password" name="password" type="password" autocomplete="new-password"> <input id="password" name="password" type="password" autocomplete="new-password">
<p class="help">{{.i18n.Tr "admin.users.password_helper"}}</p> <p class="help">{{.i18n.Tr "admin.users.password_helper"}}</p>
</div> </div>
<div class="field {{if .Err_Description}}error{{end}}">
<label for="description">{{$.i18n.Tr "user.user_bio"}}</label>
<textarea id="description" name="description" rows="4" placeholder="{{.i18n.Tr "settings.biography_placeholder"}}">{{.User.Description}}</textarea>
</div>
<div class="field {{if .Err_Website}}error{{end}}"> <div class="field {{if .Err_Website}}error{{end}}">
<label for="website">{{.i18n.Tr "settings.website"}}</label> <label for="website">{{.i18n.Tr "settings.website"}}</label>
<input id="website" name="website" type="url" value="{{.User.Website}}" placeholder="e.g. http://mydomain.com or https://mydomain.com"> <input id="website" name="website" type="url" value="{{.User.Website}}" placeholder="e.g. http://mydomain.com or https://mydomain.com">

Loading…
Cancel
Save