mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-15 03:12:54 +03:00
1bcd7fd333
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)
22 lines
772 B
JavaScript
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;
|