2017-10-26 13:02:17 +03:00
|
|
|
import PasswordValidator from 'ghost-admin/validators/password';
|
2015-08-19 14:55:40 +03:00
|
|
|
|
2017-10-26 13:02:17 +03:00
|
|
|
export default PasswordValidator.create({
|
2015-06-07 06:19:19 +03:00
|
|
|
properties: ['newPassword'],
|
2015-10-28 14:36:45 +03:00
|
|
|
|
|
|
|
newPassword(model) {
|
|
|
|
let p1 = model.get('newPassword');
|
|
|
|
let p2 = model.get('ne2Password');
|
2014-06-27 23:08:16 +04:00
|
|
|
|
2015-07-07 20:14:23 +03:00
|
|
|
if (validator.empty(p1)) {
|
|
|
|
model.get('errors').add('newPassword', 'Please enter a password.');
|
|
|
|
this.invalidate();
|
2015-07-11 20:04:19 +03:00
|
|
|
} else if (!validator.equals(p1, p2)) {
|
|
|
|
model.get('errors').add('ne2Password', 'The two new passwords don\'t match.');
|
|
|
|
this.invalidate();
|
2014-06-27 23:08:16 +04:00
|
|
|
}
|
2017-10-26 13:02:17 +03:00
|
|
|
|
|
|
|
this.passwordValidation(model, p1, 'newPassword');
|
2014-06-27 23:08:16 +04:00
|
|
|
}
|
|
|
|
});
|