update logistration js to require json

This is Part 3 of clean-up for removing the shim from
LoginSessionView.post.  Not that the shim should be gone, the frontend
code can be simplified to always provide the shimless version of the
code.

ARCH-1253
This commit is contained in:
Robert Raposa
2019-12-12 14:06:56 -05:00
parent 44a6ca3c2f
commit 2e2ceeae8d

View File

@@ -189,14 +189,6 @@
},
saveError: function(error) {
if (error.responseJSON !== undefined) {
this.saveErrorWithoutShim(error);
} else {
this.saveErrorWithShim(error);
}
},
saveErrorWithoutShim: function(error) {
var errorCode;
var msg;
if (error.status === 0) {
@@ -233,41 +225,6 @@
this.toggleDisableButton(false);
},
saveErrorWithShim: function(error) {
var msg = error.responseText;
if (error.status === 0) {
msg = gettext('An error has occurred. Check your Internet connection and try again.');
} else if (error.status === 500) {
msg = gettext('An error has occurred. Try refreshing the page, or check your Internet connection.'); // eslint-disable-line max-len
}
this.errors = [
StringUtils.interpolate(
'<li>{msg}</li>', {
msg: msg
}
)
];
this.clearPasswordResetSuccess();
/* If we've gotten a 403 error, it means that we've successfully
* authenticated with a third-party provider, but we haven't
* linked the account to an EdX account. In this case,
* we need to prompt the user to enter a little more information
* to complete the registration process.
*/
if (error.status === 403 &&
error.responseText === 'third-party-auth' &&
this.currentProvider) {
if (!this.hideAuthWarnings) {
this.clearFormErrors();
this.renderThirdPartyAuthWarning();
}
} else {
this.renderErrors(this.defaultFormErrorsTitle, this.errors);
}
this.toggleDisableButton(false);
},
renderThirdPartyAuthWarning: function() {
var message = _.sprintf(
gettext('You have successfully signed into %(currentProvider)s, but your %(currentProvider)s' +