mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-03 03:55:26 +03:00
18614c39f6
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)
20 lines
586 B
JavaScript
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();
|
|
}
|
|
}
|
|
});
|