mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-21 09:52:06 +03:00
21 lines
633 B
JavaScript
21 lines
633 B
JavaScript
import NewUserValidator from 'ghost-admin/validators/new-user';
|
|
import validator from 'validator';
|
|
|
|
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 site title.');
|
|
this.invalidate();
|
|
}
|
|
|
|
if (!validator.isLength(blogTitle || '', 0, 150)) {
|
|
model.get('errors').add('blogTitle', 'Title is too long');
|
|
this.invalidate();
|
|
}
|
|
}
|
|
});
|