Merge pull request #10633 from edx/peter-fogg/login-no-internet
Show a message when logging in with no internet connection.
This commit is contained in:
@@ -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 ) {
|
||||
this.errors = ['<li>' + error.responseText + '</li>'];
|
||||
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 );
|
||||
|
||||
|
||||
Reference in New Issue
Block a user