mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-15 11:34:24 +03:00
3a7be0c2fd
Closes #2843 * Implemnted the ember validator correctly for both reset request and actual reset (with the token) * added reset validator * changed the request route addresses to be `/authentication/passwordreset` * changed the format of data to be `{ thing: [ {data } ] }` Missing: * notifications * tests for these use cases
25 lines
662 B
JavaScript
25 lines
662 B
JavaScript
var ResetValidator = Ember.Object.create({
|
|
validate: function (model) {
|
|
|
|
var data = model.getProperties('passwords'),
|
|
p1 = data.passwords.newPassword,
|
|
p2 = data.passwords.ne2Password,
|
|
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;
|