diff --git a/core/client/app/templates/signin.hbs b/core/client/app/templates/signin.hbs index 08d6869904..009df68653 100644 --- a/core/client/app/templates/signin.hbs +++ b/core/client/app/templates/signin.hbs @@ -4,7 +4,7 @@
{{#gh-form-group errors=model.errors hasValidated=hasValidated property="identification"}} - {{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}} {{/gh-form-group}} {{#gh-form-group errors=model.errors hasValidated=hasValidated property="password"}} diff --git a/core/client/app/validators/signin.js b/core/client/app/validators/signin.js index 8a75bd6a6f..dfb3af697d 100644 --- a/core/client/app/validators/signin.js +++ b/core/client/app/validators/signin.js @@ -2,12 +2,13 @@ import BaseValidator from './base'; var SigninValidator = BaseValidator.create({ properties: ['identification', 'signin', 'forgotPassword'], + invalidMessage: 'Email address is not valid', identification: function (model) { var id = model.get('identification'); if (!validator.empty(id) && !validator.isEmail(id)) { - model.get('errors').add('identification', 'Invalid email'); + model.get('errors').add('identification', this.get('invalidMessage')); this.invalidate(); } }, @@ -23,6 +24,11 @@ var SigninValidator = BaseValidator.create({ this.invalidate(); } + if (!validator.empty(id) && !validator.isEmail(id)) { + model.get('errors').add('identification', this.get('invalidMessage')); + this.invalidate(); + } + if (validator.empty(password)) { model.get('errors').add('password', 'Please enter a password'); this.invalidate(); @@ -35,7 +41,7 @@ var SigninValidator = BaseValidator.create({ model.get('errors').clear(); if (validator.empty(id) || !validator.isEmail(id)) { - model.get('errors').add('identification', 'Invalid email'); + model.get('errors').add('identification', this.get('invalidMessage')); this.invalidate(); } }