mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-13 14:39:52 +03:00
979c3f237c
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.
35 lines
936 B
JavaScript
35 lines
936 B
JavaScript
var SetupValidator = Ember.Object.create({
|
|
check: function (model) {
|
|
var data = model.getProperties('blogTitle', 'name', 'email', 'password'),
|
|
validationErrors = [];
|
|
|
|
if (!validator.isLength(data.blogTitle, 1)) {
|
|
validationErrors.push({
|
|
message: 'Please enter a blog title.'
|
|
});
|
|
}
|
|
|
|
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 SetupValidator;
|