Ghost/ghost/admin/app/validators/setup.js
Kevin Ansfield 042aecb7f6 Switch from embor-browserify to ember-auto-import
no issue
- minor reduction in build size. Before/after:
  - `vendor.min.js 3.32 MB (710.66 KB gzipped)`
  - `vendor.min.js 3.29 MB (706 KB gzipped)`
2019-01-22 13:09:38 +00:00

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 blog title.');
this.invalidate();
}
if (!validator.isLength(blogTitle || '', 0, 150)) {
model.get('errors').add('blogTitle', 'Title is too long');
this.invalidate();
}
}
});