Ghost/core/client/app/validators/reset.js
Kevin Ansfield 1bcd7fd333 Replace validation notifications with inline validations
issue #5409 & #5336

- update settings/general
- update signin
- update signup
- update edit user
- update reset password
- update setup/three
- remove `formatErrors` function from validationEngine mixin (it's no longer needed as inline validations should handle this instead)
2015-07-28 12:26:34 +01:00

22 lines
772 B
JavaScript

import BaseValidator from './base';
var ResetValidator = BaseValidator.create({
properties: ['newPassword'],
newPassword: function (model) {
var p1 = model.get('newPassword'),
p2 = model.get('ne2Password');
if (validator.empty(p1)) {
model.get('errors').add('newPassword', 'Please enter a password.');
this.invalidate();
} else if (!validator.isLength(p1, 8)) {
model.get('errors').add('newPassword', 'The password is not long enough.');
this.invalidate();
} else if (!validator.equals(p1, p2)) {
model.get('errors').add('ne2Password', 'The two new passwords don\'t match.');
this.invalidate();
}
}
});
export default ResetValidator;