|
|
@ -21,7 +21,7 @@ type Form interface { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
type RegisterForm struct { |
|
|
|
type RegisterForm struct { |
|
|
|
UserName string `form:"username" binding:"Required;AlphaDash;MaxSize(30)"` |
|
|
|
UserName string `form:"username" binding:"Required;AlphaDashDot;MaxSize(30)"` |
|
|
|
Email string `form:"email" binding:"Required;Email;MaxSize(50)"` |
|
|
|
Email string `form:"email" binding:"Required;Email;MaxSize(50)"` |
|
|
|
Password string `form:"passwd" binding:"Required;MinSize(6);MaxSize(30)"` |
|
|
|
Password string `form:"passwd" binding:"Required;MinSize(6);MaxSize(30)"` |
|
|
|
RetypePasswd string `form:"retypepasswd"` |
|
|
|
RetypePasswd string `form:"retypepasswd"` |
|
|
@ -123,6 +123,8 @@ func validate(errors *base.BindingErrors, data base.TmplData, form Form) { |
|
|
|
data["ErrorMsg"] = form.Name(field.Name) + " cannot be empty" |
|
|
|
data["ErrorMsg"] = form.Name(field.Name) + " cannot be empty" |
|
|
|
case base.BindingAlphaDashError: |
|
|
|
case base.BindingAlphaDashError: |
|
|
|
data["ErrorMsg"] = form.Name(field.Name) + " must be valid alpha or numeric or dash(-_) characters" |
|
|
|
data["ErrorMsg"] = form.Name(field.Name) + " must be valid alpha or numeric or dash(-_) characters" |
|
|
|
|
|
|
|
case base.BindingAlphaDashDotError: |
|
|
|
|
|
|
|
data["ErrorMsg"] = form.Name(field.Name) + " must be valid alpha or numeric or dash(-_) or dot characters" |
|
|
|
case base.BindingMinSizeError: |
|
|
|
case base.BindingMinSizeError: |
|
|
|
data["ErrorMsg"] = form.Name(field.Name) + " must contain at least " + getMinMaxSize(field) + " characters" |
|
|
|
data["ErrorMsg"] = form.Name(field.Name) + " must contain at least " + getMinMaxSize(field) + " characters" |
|
|
|
case base.BindingMaxSizeError: |
|
|
|
case base.BindingMaxSizeError: |
|
|
|