mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-13 22:41:32 -05:00
8322991c42
refs #5520 - all errors (or just one if property is specified) are cleared before running the checks to make sure that old errors get cleared - fixed up validators to be slightly more sane as mutually exclusive tests aren't all being checked if one fails
18 lines
619 B
JavaScript
18 lines
619 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.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;
|