mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-15 19:52:01 +03:00
ab97c8c861
Closes #2976, Closes #3017 - Move logic to signup controller - Add ValidationEngine mixin to signup controller - Add signup validator with code from clientold login view - Add signin validator and integrate into signin controller - Add validation to forgotten controller - Switch to button action to support hitting enter in text field to submit - Clear all notifications in notifications.closeAll - Modify ValidationEngine.validate to not format errors based on option - Update casper test for signin to wait for notification before trying to do another signin
29 lines
757 B
JavaScript
29 lines
757 B
JavaScript
var SignupValidator = Ember.Object.create({
|
|
validate: function (model) {
|
|
var data = model.getProperties('name', 'email', 'password'),
|
|
validationErrors = [];
|
|
|
|
if (!validator.isLength(data.name || '', 1)) {
|
|
validationErrors.push({
|
|
message: 'Please enter a name.'
|
|
});
|
|
}
|
|
|
|
if (!validator.isEmail(data.email)) {
|
|
validationErrors.push({
|
|
message: 'Invalid Email.'
|
|
});
|
|
}
|
|
|
|
if (!validator.isLength(data.password || '', 1)) {
|
|
validationErrors.push({
|
|
message: 'Please enter a password.'
|
|
});
|
|
}
|
|
|
|
return validationErrors;
|
|
}
|
|
});
|
|
|
|
export default SignupValidator;
|