Validate min length of 5 for username, 8 for password

This commit is contained in:
Nathan Leniz
2015-03-10 08:17:10 +09:00
parent a65216e29e
commit d6a6834971
2 changed files with 4 additions and 4 deletions

View File

@ -103,14 +103,14 @@ exports.postEmailSignup = function(req, res, next) {
var possibleUserData = req.body; var possibleUserData = req.body;
if (possibleUserData.password.length < 5) { if (possibleUserData.password.length < 8) {
req.flash('errors', { req.flash('errors', {
msg: 'Your password is too short' msg: 'Your password is too short'
}); });
return res.redirect('email-signup'); return res.redirect('email-signup');
} }
if (possibleUserData.username.length < 8 || possibleUserData.length > 20) { if (possibleUserData.username.length < 5 || possibleUserData.length > 20) {
req.flash('errors', { req.flash('errors', {
msg: 'Your username must be between 5 and 20 characters' msg: 'Your username must be between 5 and 20 characters'
}); });

View File

@ -21,7 +21,7 @@ block content
| That email address is already in use. | That email address is already in use.
.form-group .form-group
.col-sm-6.col-sm-offset-3 .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") .col-sm-6.col-sm-offset-3(ng-cloak, ng-show="profileForm.username.$error.pattern && !signupForm.username.$pristine")
alert(type='danger') alert(type='danger')
span.ion-close-circled span.ion-close-circled
@ -40,7 +40,7 @@ block content
| Your usernames must be 20 characters or fewer. | Your usernames must be 20 characters or fewer.
.form-group .form-group
.col-sm-6.col-sm-offset-3 .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") .col-sm-6.col-sm-offset-3(ng-cloak, ng-show="signupForm.password.$error.minlength && !signupForm.password.$pristine")
alert(type='danger') alert(type='danger')
span.ion-close-circled span.ion-close-circled