Ghost/core/client/app/validators/reset.js
Austin Burdine d0c151be70 adds inline errors to validation
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
2015-07-05 14:02:06 -04:00

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;