mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-27 22:49:56 -05:00
18 lines
467 B
JavaScript
18 lines
467 B
JavaScript
|
import BaseValidator from './base';
|
||
|
|
||
|
export default BaseValidator.create({
|
||
|
properties: ['email'],
|
||
|
|
||
|
email(model) {
|
||
|
let email = model.get('email');
|
||
|
|
||
|
if (validator.empty(email)) {
|
||
|
model.get('errors').add('email', 'Please enter an email.');
|
||
|
this.invalidate();
|
||
|
} else if (!validator.isEmail(email)) {
|
||
|
model.get('errors').add('email', 'Invalid Email.');
|
||
|
this.invalidate();
|
||
|
}
|
||
|
}
|
||
|
});
|