mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-21 09:52:06 +03:00
a22dca8722
No issue - Created NewUserValidator class to DRY up validation of a models name, email, and password - Changed SignUpValidator to be an instance of NewUserValidator - Changed SetUpValidator to extend NewUserValidator
19 lines
496 B
JavaScript
19 lines
496 B
JavaScript
import NewUserValidator from 'ghost/validators/new-user';
|
|
|
|
var SetupValidator = NewUserValidator.extend({
|
|
check: function (model) {
|
|
var data = model.getProperties('blogTitle'),
|
|
validationErrors = this._super(model);
|
|
|
|
if (!validator.isLength(data.blogTitle, 1)) {
|
|
validationErrors.push({
|
|
message: 'Please enter a blog title.'
|
|
});
|
|
}
|
|
|
|
return validationErrors;
|
|
}
|
|
}).create();
|
|
|
|
export default SetupValidator;
|