0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-01-06 22:40:14 -05:00

Provide a more intuitive error message on sign-in for missing email

issue 4651#issuecomment-112141801
- display "Please enter an email" validation message rather than "Invalid Email" when no email is entered
This commit is contained in:
Kevin Ansfield 2015-06-17 22:56:02 +01:00
parent 4b90c3c308
commit db558e38ea
2 changed files with 16 additions and 2 deletions

View file

@ -4,7 +4,9 @@ var SigninValidator = Ember.Object.create({
var data = model.getProperties('identification', 'password'),
validationErrors = [];
if (!validator.isEmail(data.identification)) {
if (validator.empty(data.identification)) {
validationErrors.push('Please enter an email');
} else if (!validator.isEmail(data.identification)) {
validationErrors.push('Invalid Email');
}

View file

@ -111,7 +111,7 @@ CasperTest.begin('Authenticated user is redirected', 6, function suite(test) {
});
}, true);
CasperTest.begin('Ensure email field form validation', 3, function suite(test) {
CasperTest.begin('Ensure email field form validation', 4, function suite(test) {
CasperTest.Routines.signout.run(test);
casper.thenOpenAndWaitForPageLoad('signin', function testTitleAndUrl() {
@ -134,4 +134,16 @@ CasperTest.begin('Ensure email field form validation', 3, function suite(test) {
}, function onTimeout() {
test.fail('Email validation error did not appear');
}, 2000);
casper.then(function testMissingEmail() {
this.fillAndSave('form.gh-signin', {
identification: ''
});
});
casper.waitForSelectorTextChange('.notification-error', function onSuccess() {
test.assertSelectorHasText('.notification-error', 'Please enter an email', '.notification-error text is correct');
}, function onTimeout() {
test.fail('Missing Email validation error did not appear');
}, 2000);
}, true);