2015-06-07 06:19:19 +03:00
|
|
|
import BaseValidator from './base';
|
|
|
|
var ResetValidator = BaseValidator.create({
|
|
|
|
properties: ['newPassword'],
|
|
|
|
newPassword: function (model) {
|
2014-10-02 19:12:54 +04:00
|
|
|
var p1 = model.get('newPassword'),
|
2015-06-07 06:19:19 +03:00
|
|
|
p2 = model.get('ne2Password');
|
2014-06-27 23:08:16 +04:00
|
|
|
|
|
|
|
if (!validator.equals(p1, p2)) {
|
2015-06-07 06:19:19 +03:00
|
|
|
model.get('errors').add('ne2Password', 'The two new passwords don\'t match.');
|
|
|
|
this.invalidate();
|
2014-06-27 23:08:16 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
if (!validator.isLength(p1, 8)) {
|
2015-06-07 06:19:19 +03:00
|
|
|
model.get('errors').add('newPassword', 'The password is not long enough.');
|
|
|
|
this.invalidate();
|
2014-06-27 23:08:16 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
export default ResetValidator;
|