Allow 1 letter usernames
This commit is contained in:
parent
c01f593daa
commit
52de63e7bb
3 changed files with 3 additions and 4 deletions
|
@ -23,7 +23,7 @@ type Form interface {
|
||||||
}
|
}
|
||||||
|
|
||||||
type RegisterForm struct {
|
type RegisterForm struct {
|
||||||
UserName string `form:"username" binding:"Required;AlphaDash;MinSize(5);MaxSize(30)"`
|
UserName string `form:"username" binding:"Required;AlphaDash;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"`
|
||||||
|
@ -59,7 +59,7 @@ func (f *RegisterForm) Validate(errors *binding.Errors, req *http.Request, conte
|
||||||
}
|
}
|
||||||
|
|
||||||
type LogInForm struct {
|
type LogInForm struct {
|
||||||
UserName string `form:"username" binding:"Required;AlphaDash;MinSize(5);MaxSize(30)"`
|
UserName string `form:"username" binding:"Required;AlphaDash;MaxSize(30)"`
|
||||||
Password string `form:"passwd" binding:"Required;MinSize(6);MaxSize(30)"`
|
Password string `form:"passwd" binding:"Required;MinSize(6);MaxSize(30)"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -78,7 +78,6 @@ function initRegister() {
|
||||||
rules: {
|
rules: {
|
||||||
"username": {
|
"username": {
|
||||||
required: true,
|
required: true,
|
||||||
minlength: 5,
|
|
||||||
maxlength: 30
|
maxlength: 30
|
||||||
},
|
},
|
||||||
"email": {
|
"email": {
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
<div class="form-group {{if .Err_UserName}}has-error has-feedback{{end}}">
|
<div class="form-group {{if .Err_UserName}}has-error has-feedback{{end}}">
|
||||||
<label class="col-md-4 control-label">Username: </label>
|
<label class="col-md-4 control-label">Username: </label>
|
||||||
<div class="col-md-6">
|
<div class="col-md-6">
|
||||||
<input name="username" class="form-control" placeholder="Type your username" value="{{.username}}" required="required" title="Username must contain at least 5 characters">
|
<input name="username" class="form-control" placeholder="Type your username" value="{{.username}}" required="required">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue