Commit c8fbadb2 by Peter Fogg

Show a message when logging in with no internet connection.

ECOM-2890
parent b05c4af4
......@@ -265,6 +265,21 @@
expect(view.$errors).toHaveClass('hidden');
expect(authComplete).toBe(true);
});
it('displays an error if there is no internet connection', function () {
createLoginView(this);
// Submit the form, with successful validation
submitForm(true);
// Simulate an error from the LMS servers
AjaxHelpers.respondWithError(requests, 0);
// Expect that an error is displayed and that auth complete is not triggered
expect(view.$errors).not.toHaveClass('hidden');
expect(authComplete).toBe(false);
expect(view.$errors.text()).toContain('Please check your internet connection and try again.');
});
});
});
}).call(this, define || RequireJS.define);
......@@ -3,9 +3,10 @@
define([
'jquery',
'underscore',
'gettext',
'js/student_account/views/FormView'
],
function($, _, FormView) {
function($, _, gettext, FormView) {
return FormView.extend({
el: '#login-form',
......@@ -102,7 +103,12 @@
},
saveError: function( error ) {
if (error.status === 0) {
this.errors = ['<li>' + gettext('Please check your internet connection and try again.') + '</li>'];
}
else {
this.errors = ['<li>' + error.responseText + '</li>'];
}
this.setErrors();
this.element.hide( this.$resetSuccess );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment