2015-02-12 21:22:32 -07:00
|
|
|
import Ember from 'ember';
|
2014-06-27 20:08:16 +01:00
|
|
|
var ResetValidator = Ember.Object.create({
|
2014-06-29 23:43:25 -04:00
|
|
|
check: function (model) {
|
2014-10-02 09:12:54 -06:00
|
|
|
var p1 = model.get('newPassword'),
|
|
|
|
p2 = model.get('ne2Password'),
|
2014-06-27 20:08:16 +01:00
|
|
|
validationErrors = [];
|
|
|
|
|
|
|
|
if (!validator.equals(p1, p2)) {
|
|
|
|
validationErrors.push({
|
|
|
|
message: 'The two new passwords don\'t match.'
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!validator.isLength(p1, 8)) {
|
|
|
|
validationErrors.push({
|
|
|
|
message: 'The password is not long enough.'
|
|
|
|
});
|
|
|
|
}
|
|
|
|
return validationErrors;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
export default ResetValidator;
|