diff options
author | Unknwon <joe2010xtmf@163.com> | 2014-10-15 11:19:20 -0400 |
---|---|---|
committer | Unknwon <joe2010xtmf@163.com> | 2014-10-15 11:19:20 -0400 |
commit | fa241efa6d5e934f599e43714e970fa48c9a0f47 (patch) | |
tree | 0a9e74e4849758a5970fd52589e96662bc105600 /modules/auth/user_form.go | |
parent | ecf3eb4307c13c74d928656a140b7bb2ae804fd9 (diff) | |
download | gitea-fa241efa6d5e934f599e43714e970fa48c9a0f47.tar.gz gitea-fa241efa6d5e934f599e43714e970fa48c9a0f47.zip |
Use binding middleware
Diffstat (limited to 'modules/auth/user_form.go')
-rw-r--r-- | modules/auth/user_form.go | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/modules/auth/user_form.go b/modules/auth/user_form.go index 93bd01a9fd..72bdd4589f 100644 --- a/modules/auth/user_form.go +++ b/modules/auth/user_form.go @@ -6,9 +6,7 @@ package auth import ( "github.com/Unknwon/macaron" - "github.com/macaron-contrib/i18n" - - "github.com/gogits/gogs/modules/middleware/binding" + "github.com/macaron-contrib/binding" ) type InstallForm struct { @@ -34,8 +32,8 @@ type InstallForm struct { AdminEmail string `form:"admin_email" binding:"Required;Email;MaxSize(50)"` } -func (f *InstallForm) Validate(ctx *macaron.Context, errs *binding.Errors, l i18n.Locale) { - validate(errs, ctx.Data, f, l) +func (f *InstallForm) Validate(ctx *macaron.Context, errs binding.Errors) binding.Errors { + return validate(errs, ctx.Data, f, ctx.Locale) } // _____ ____ _________________ ___ @@ -54,8 +52,8 @@ type RegisterForm struct { LoginName string `form:"loginname"` } -func (f *RegisterForm) Validate(ctx *macaron.Context, errs *binding.Errors, l i18n.Locale) { - validate(errs, ctx.Data, f, l) +func (f *RegisterForm) Validate(ctx *macaron.Context, errs binding.Errors) binding.Errors { + return validate(errs, ctx.Data, f, ctx.Locale) } type SignInForm struct { @@ -64,8 +62,8 @@ type SignInForm struct { Remember bool `form:"remember"` } -func (f *SignInForm) Validate(ctx *macaron.Context, errs *binding.Errors, l i18n.Locale) { - validate(errs, ctx.Data, f, l) +func (f *SignInForm) Validate(ctx *macaron.Context, errs binding.Errors) binding.Errors { + return validate(errs, ctx.Data, f, ctx.Locale) } // __________________________________________.___ _______ ________ _________ @@ -84,8 +82,8 @@ type UpdateProfileForm struct { Avatar string `form:"avatar" binding:"Required;Email;MaxSize(50)"` } -func (f *UpdateProfileForm) Validate(ctx *macaron.Context, errs *binding.Errors, l i18n.Locale) { - validate(errs, ctx.Data, f, l) +func (f *UpdateProfileForm) Validate(ctx *macaron.Context, errs binding.Errors) binding.Errors { + return validate(errs, ctx.Data, f, ctx.Locale) } type ChangePasswordForm struct { @@ -94,6 +92,6 @@ type ChangePasswordForm struct { Retype string `form:"retype"` } -func (f *ChangePasswordForm) Validate(ctx *macaron.Context, errs *binding.Errors, l i18n.Locale) { - validate(errs, ctx.Data, f, l) +func (f *ChangePasswordForm) Validate(ctx *macaron.Context, errs binding.Errors) binding.Errors { + return validate(errs, ctx.Data, f, ctx.Locale) } |