Validate min length of 5 for username, 8 for password
parent
a65216e29e
commit
d6a6834971
|
@ -103,14 +103,14 @@ exports.postEmailSignup = function(req, res, next) {
|
|||
|
||||
var possibleUserData = req.body;
|
||||
|
||||
if (possibleUserData.password.length < 5) {
|
||||
if (possibleUserData.password.length < 8) {
|
||||
req.flash('errors', {
|
||||
msg: 'Your password is too short'
|
||||
});
|
||||
return res.redirect('email-signup');
|
||||
}
|
||||
|
||||
if (possibleUserData.username.length < 8 || possibleUserData.length > 20) {
|
||||
if (possibleUserData.username.length < 5 || possibleUserData.length > 20) {
|
||||
req.flash('errors', {
|
||||
msg: 'Your username must be between 5 and 20 characters'
|
||||
});
|
||||
|
|
|
@ -21,7 +21,7 @@ block content
|
|||
| That email address is already in use.
|
||||
.form-group
|
||||
.col-sm-6.col-sm-offset-3
|
||||
input.form-control(type='text', name='username', ng-keypress='', autocomplete="off", id='username', placeholder='username', ng-model='username', unique-username='', required, ng-minlength=8, ng-maxlength=20, ng-pattern="/^[A-z0-9_]+$/")
|
||||
input.form-control(type='text', name='username', ng-keypress='', autocomplete="off", id='username', placeholder='username', ng-model='username', unique-username='', required, ng-minlength=5, ng-maxlength=20, ng-pattern="/^[A-z0-9_]+$/")
|
||||
.col-sm-6.col-sm-offset-3(ng-cloak, ng-show="profileForm.username.$error.pattern && !signupForm.username.$pristine")
|
||||
alert(type='danger')
|
||||
span.ion-close-circled
|
||||
|
@ -40,7 +40,7 @@ block content
|
|||
| Your usernames must be 20 characters or fewer.
|
||||
.form-group
|
||||
.col-sm-6.col-sm-offset-3
|
||||
input.form-control(type='password', ng-model='password', name='password', id='password', placeholder='password', required, ng-minlength=5)
|
||||
input.form-control(type='password', ng-model='password', name='password', id='password', placeholder='password', required, ng-minlength=8)
|
||||
.col-sm-6.col-sm-offset-3(ng-cloak, ng-show="signupForm.password.$error.minlength && !signupForm.password.$pristine")
|
||||
alert(type='danger')
|
||||
span.ion-close-circled
|
||||
|
|
Loading…
Reference in New Issue