mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-20 17:32:15 +03:00
25ff26016e
Closes #3145 - Prevent navigation to the setup screen if Ghost setup has previously been completed. - Fix templates that were incorrectly using foreach instead of each. - Add validation for minimum password length. - Fix up functional tests and split out tests for setup to a separate instance of casper because setup requires a new database. - Add a cleanDatabase task to grunt which resets the database to new.
29 lines
754 B
JavaScript
29 lines
754 B
JavaScript
var SignupValidator = Ember.Object.create({
|
|
check: 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, 8)) {
|
|
validationErrors.push({
|
|
message: 'Password must be at least 8 characters long.'
|
|
});
|
|
}
|
|
|
|
return validationErrors;
|
|
}
|
|
});
|
|
|
|
export default SignupValidator;
|