mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-14 18:52:05 +03:00
d0c151be70
closes #5336 - creates gh-form-group component to handle form group status - refactors current validation methods to work on a per-property basis - adds gh-error-message component to render error message - removes (comments out) tests that pertain to the old notifications until the new inline validation is added
21 lines
623 B
JavaScript
21 lines
623 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.equals(p1, p2)) {
|
|
model.get('errors').add('ne2Password', 'The two new passwords don\'t match.');
|
|
this.invalidate();
|
|
}
|
|
|
|
if (!validator.isLength(p1, 8)) {
|
|
model.get('errors').add('newPassword', 'The password is not long enough.');
|
|
this.invalidate();
|
|
}
|
|
}
|
|
});
|
|
|
|
export default ResetValidator;
|