Ghost/ghost/admin/app/validators/setup.js
Aileen Nowak 18614c39f6 Added missing client validations for blog title and user/subscriber email fields (#909)
refs TryGhost/Ghost#8143

Added more client side validations for input fields:

- Blog title in setup flow (150 chars)
- User email (191 chars)
- Subscribers email (191 chars)
2017-11-16 12:47:56 +00:00

20 lines
586 B
JavaScript

import NewUserValidator from 'ghost-admin/validators/new-user';
export default NewUserValidator.create({
properties: ['name', 'email', 'password', 'blogTitle'],
blogTitle(model) {
let blogTitle = model.get('blogTitle');
if (!validator.isLength(blogTitle, 1)) {
model.get('errors').add('blogTitle', 'Please enter a blog title.');
this.invalidate();
}
if (!validator.isLength(blogTitle, 0, 150)) {
model.get('errors').add('blogTitle', 'Title is too long');
this.invalidate();
}
}
});