Warn that password must be at leeast 4 characters long.

This commit is contained in:
opi 2014-03-02 19:42:02 +01:00
parent db9e70d34f
commit 0dbe01e399
2 changed files with 11 additions and 4 deletions

View file

@ -393,10 +393,16 @@ app = Sammy('#main', function (sam) {
sam.post('#/users', function (c) { sam.post('#/users', function (c) {
if (c.params['password'] == c.params['confirmation']) { if (c.params['password'] == c.params['confirmation']) {
c.params['mail'] = c.params['email'] + c.params['domain']; if (c.params['password'].length < 4) {
c.api('/users', function(data) { // http://api.yunohost.org/#!/user/user_create_post_2 c.flash('fail', "Passwords is too short");
c.redirect('#/users'); store.clear('slide');
}, 'POST', c.params.toHash()); }
else {
c.params['mail'] = c.params['email'] + c.params['domain'];
c.api('/users', function(data) { // http://api.yunohost.org/#!/user/user_create_post_2
c.redirect('#/users');
}, 'POST', c.params.toHash());
}
} else { } else {
c.flash('fail', "Passwords don't match"); c.flash('fail', "Passwords don't match");
store.clear('slide'); store.clear('slide');

View file

@ -52,6 +52,7 @@
<label for="confirmation" class="col-sm-3 control-label">Confirmation</label> <label for="confirmation" class="col-sm-3 control-label">Confirmation</label>
<div class="col-sm-9"> <div class="col-sm-9">
<input type="password" name="confirmation" class="form-control" placeholder="•••••" required> <input type="password" name="confirmation" class="form-control" placeholder="•••••" required>
<div class="help-block">Password must be at least 4 characters long.</div>
</div> </div>
</div> </div>
</div> </div>