2015-02-13 05:22:32 +01:00
|
|
|
import Ember from 'ember';
|
2014-06-27 21:08:16 +02:00
|
|
|
var ResetValidator = Ember.Object.create({
|
2014-06-30 05:43:25 +02:00
|
|
|
check: function (model) {
|
2014-10-02 17:12:54 +02:00
|
|
|
var p1 = model.get('newPassword'),
|
|
|
|
p2 = model.get('ne2Password'),
|
2014-06-27 21:08:16 +02: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;
|