Skip to content

Commit

Permalink
temp: Add configuration option to redirect to external site when TAP …
Browse files Browse the repository at this point in the history
…account is unlinked

(cherry picked from commit e83a8c8)
  • Loading branch information
xitij2000 committed Jun 22, 2023
1 parent eaf0597 commit 79cfccf
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
3 changes: 3 additions & 0 deletions lms/static/js/student_account/views/LoginView.js
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,7 @@
saveError: function(error) {
var errorCode;
var msg;
var redirectURL;
if (error.status === 0) {
msg = gettext('An error has occurred. Check your Internet connection and try again.');
} else if (error.status === 500) {
Expand Down Expand Up @@ -242,6 +243,7 @@
} else if (error.responseJSON !== undefined) {
msg = error.responseJSON.value;
errorCode = error.responseJSON.error_code;
redirectURL = error.responseJSON.redirect_url;
} else {
msg = gettext('An unexpected error has occurred.');
}
Expand All @@ -263,6 +265,7 @@
this.clearFormErrors();
this.renderThirdPartyAuthWarning();
}
window.location.href = redirectURL;
} else {
this.renderErrors(this.defaultFormErrorsTitle, this.errors);
}
Expand Down
8 changes: 7 additions & 1 deletion openedx/core/djangoapps/user_authn/views/login.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,13 @@ def _do_third_party_auth(request):
)
)

raise AuthFailedError(message, error_code='third-party-auth-with-no-linked-account') # lint-amnesty, pylint: disable=raise-missing-from
redirect_url = configuration_helpers.get_value('OC_REDIRECT_ON_TPA_UNLINKED_ACCOUNT', None)

raise AuthFailedError(
message,
error_code='third-party-auth-with-no-linked-account',
redirect_url=redirect_url
) # lint-amnesty, pylint: disable=raise-missing-from


def _get_user_by_email(email):
Expand Down

0 comments on commit 79cfccf

Please sign in to comment.