diff options
Diffstat (limited to 'modules/auth/admin.go')
-rw-r--r-- | modules/auth/admin.go | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/modules/auth/admin.go b/modules/auth/admin.go index 596e5d642e..16c2921c97 100644 --- a/modules/auth/admin.go +++ b/modules/auth/admin.go @@ -10,17 +10,29 @@ import ( "github.com/macaron-contrib/binding" ) +type AdminCrateUserForm struct { + LoginType string `binding:"Required"` + LoginName string + UserName string `binding:"Required;AlphaDashDot;MaxSize(35)"` + Email string `binding:"Required;Email;MaxSize(254)"` + Password string `binding:"MaxSize(255)"` +} + +func (f *AdminCrateUserForm) Validate(ctx *macaron.Context, errs binding.Errors) binding.Errors { + return validate(errs, ctx.Data, f, ctx.Locale) +} + type AdminEditUserForm struct { - FullName string `form:"fullname" binding:"MaxSize(100)"` + LoginType string `binding:"Required"` + LoginName string + FullName string `binding:"MaxSize(100)"` Email string `binding:"Required;Email;MaxSize(254)"` - Password string `binding:"OmitEmpty;MinSize(6);MaxSize(255)"` + Password string `binding:"MaxSize(255)"` Website string `binding:"MaxSize(50)"` Location string `binding:"MaxSize(50)"` - Avatar string `binding:"Required;Email;MaxSize(50)"` Active bool Admin bool AllowGitHook bool - LoginType int } func (f *AdminEditUserForm) Validate(ctx *macaron.Context, errs binding.Errors) binding.Errors { |