mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-02-03 23:00:14 -05:00
Add email validation back to signin
refs #5745 - signin form was not checking email address was valid
This commit is contained in:
parent
7a0b7aca80
commit
435731a322
2 changed files with 9 additions and 3 deletions
|
@ -4,7 +4,7 @@
|
||||||
<form id="login" class="gh-signin" method="post" novalidate="novalidate">
|
<form id="login" class="gh-signin" method="post" novalidate="novalidate">
|
||||||
{{#gh-form-group errors=model.errors property="identification"}}
|
{{#gh-form-group errors=model.errors property="identification"}}
|
||||||
<span class="input-icon icon-mail">
|
<span class="input-icon icon-mail">
|
||||||
{{gh-trim-focus-input class="gh-input email" type="email" placeholder="Email Address" name="identification" autocapitalize="off" autocorrect="off" tabindex="1" value=model.identification}}
|
{{gh-trim-focus-input class="gh-input email" type="email" placeholder="Email Address" name="identification" autocapitalize="off" autocorrect="off" tabindex="1" focusOut=(action "validate" "identification") value=model.identification}}
|
||||||
</span>
|
</span>
|
||||||
{{/gh-form-group}}
|
{{/gh-form-group}}
|
||||||
{{#gh-form-group errors=model.errors property="password"}}
|
{{#gh-form-group errors=model.errors property="password"}}
|
||||||
|
|
|
@ -2,12 +2,13 @@ import BaseValidator from './base';
|
||||||
|
|
||||||
var SigninValidator = BaseValidator.create({
|
var SigninValidator = BaseValidator.create({
|
||||||
properties: ['identification', 'signin', 'forgotPassword'],
|
properties: ['identification', 'signin', 'forgotPassword'],
|
||||||
|
invalidMessage: 'Email address is not valid',
|
||||||
|
|
||||||
identification: function (model) {
|
identification: function (model) {
|
||||||
var id = model.get('identification');
|
var id = model.get('identification');
|
||||||
|
|
||||||
if (!validator.empty(id) && !validator.isEmail(id)) {
|
if (!validator.empty(id) && !validator.isEmail(id)) {
|
||||||
model.get('errors').add('identification', 'Invalid email');
|
model.get('errors').add('identification', this.get('invalidMessage'));
|
||||||
this.invalidate();
|
this.invalidate();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -23,6 +24,11 @@ var SigninValidator = BaseValidator.create({
|
||||||
this.invalidate();
|
this.invalidate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!validator.empty(id) && !validator.isEmail(id)) {
|
||||||
|
model.get('errors').add('identification', this.get('invalidMessage'));
|
||||||
|
this.invalidate();
|
||||||
|
}
|
||||||
|
|
||||||
if (validator.empty(password)) {
|
if (validator.empty(password)) {
|
||||||
model.get('errors').add('password', 'Please enter a password');
|
model.get('errors').add('password', 'Please enter a password');
|
||||||
this.invalidate();
|
this.invalidate();
|
||||||
|
@ -35,7 +41,7 @@ var SigninValidator = BaseValidator.create({
|
||||||
model.get('errors').clear();
|
model.get('errors').clear();
|
||||||
|
|
||||||
if (validator.empty(id) || !validator.isEmail(id)) {
|
if (validator.empty(id) || !validator.isEmail(id)) {
|
||||||
model.get('errors').add('identification', 'Invalid email');
|
model.get('errors').add('identification', this.get('invalidMessage'));
|
||||||
this.invalidate();
|
this.invalidate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue