mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-25 03:44:29 +03:00
2f4f6db133
no issue - add ember-suave dependency - upgrade grunt-jscs dependency - add a new .jscsrc for the client's tests directory that extends from client's base .jscsrc - separate client tests in Gruntfile jscs task so they pick up the test's .jscsrc - standardize es6 usage across client
22 lines
725 B
JavaScript
22 lines
725 B
JavaScript
import BaseValidator from './base';
|
|
|
|
export default BaseValidator.create({
|
|
properties: ['newPassword'],
|
|
|
|
newPassword(model) {
|
|
let p1 = model.get('newPassword');
|
|
let p2 = model.get('ne2Password');
|
|
|
|
if (validator.empty(p1)) {
|
|
model.get('errors').add('newPassword', 'Please enter a password.');
|
|
this.invalidate();
|
|
} else 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();
|
|
}
|
|
}
|
|
});
|