mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-15 03:12:54 +03:00
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;
|