Skip to content
Prev Previous commit
Next Next commit
fix: prevent redirects to /undefined after saml auth
When a user authenticates using SAML, but their accounts aren't linked,
they land on the login page with the message to link their accounts. If the
`OC_REDIRECT_ON_TPA_UNLINKED_ACCOUNT` value is not set, they are redirected to
`/undefined`. This commit checks that the `redirectURL` is a valid non-empty
string before performing the redirect.

The bug was introduced in 91f8d36, so this can be safely dropped once that
temporary commit is removed from our branches. For Redwood, the relevant
commit hash is 64f5dea.

Internal-ref: https://tasks.opencraft.com/browse/BB-9010
(cherry picked from commit 9ade4ea)
(cherry picked from commit b801f99)
(cherry picked from commit 21787b7)
(cherry picked from commit ed2d2b5)
(cherry picked from commit f9053ef)
  • Loading branch information
tecoholic authored and xitij2000 committed Aug 12, 2026
commit d6fb45ebe5625ae73b202cca0beb37b9682210b2
4 changes: 3 additions & 1 deletion lms/static/js/student_account/views/LoginView.js
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,9 @@
this.clearFormErrors();
this.renderThirdPartyAuthWarning();
}
window.location.href = redirectURL;
if (typeof redirectURL === "string" && redirectURL.length) {
window.location.href = redirectURL;
}
} else {
this.renderErrors(this.defaultFormErrorsTitle, this.errors);
}
Expand Down