summaryrefslogtreecommitdiffstats
path: root/modules/auth/admin.go
diff options
context:
space:
mode:
authorUnknwon <u@gogs.io>2015-09-13 11:07:21 -0400
committerUnknwon <u@gogs.io>2015-09-13 11:07:21 -0400
commit83e747bfda43c2c8fa0aceb2c989d42fe5ca1582 (patch)
tree1dfee9128010bb08ad2177c24fd1c5c8c53d45cd /modules/auth/admin.go
parente5ed5904c62d9a618cb6f4ad852b021a02c3481e (diff)
downloadgitea-83e747bfda43c2c8fa0aceb2c989d42fe5ca1582.tar.gz
gitea-83e747bfda43c2c8fa0aceb2c989d42fe5ca1582.zip
#697 and #1606 and new admin edit user UI
Diffstat (limited to 'modules/auth/admin.go')
-rw-r--r--modules/auth/admin.go20
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 {