From d9d761af87cf4af090db6f7f053260e8b6d76997 Mon Sep 17 00:00:00 2001 From: Arunmozhi Date: Fri, 9 Aug 2024 14:32:05 +1000 Subject: [PATCH] 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 setup, they end up getting redirected to /undefined. This commit validates the redirectURL as a valid string before performing the redirect. Internal-ref: https://tasks.opencraft.com/browse/BB-9010 --- lms/static/js/student_account/views/LoginView.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lms/static/js/student_account/views/LoginView.js b/lms/static/js/student_account/views/LoginView.js index 2d5126709db2..0a859e2275ee 100644 --- a/lms/static/js/student_account/views/LoginView.js +++ b/lms/static/js/student_account/views/LoginView.js @@ -267,7 +267,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); }