Skip to content

Commit

Permalink
Merge pull request #6886 from HasiniSama/redirection-expired-code
Browse files Browse the repository at this point in the history
Fixed redirection issue in Go Back button in expired password reset error page
  • Loading branch information
pavinduLakshan authored Sep 12, 2024
2 parents 28696b4 + 1b75507 commit f59eb30
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .changeset/yellow-rocks-destroy.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@wso2is/identity-apps-core": patch
---

Fixed redirection issue in Go Back button in expired password reset error page
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<%--
~ Copyright (c) 2016-2023, WSO2 LLC. (https://www.wso2.com).
~ Copyright (c) 2016-2024, WSO2 LLC. (https://www.wso2.com).
~
~ WSO2 LLC. licenses this file to you under the Apache License,
~ Version 2.0 (the "License"); you may not use this file except
Expand Down Expand Up @@ -44,6 +44,7 @@
String errorMsg = IdentityManagementEndpointUtil.getStringValue(request.getAttribute("errorMsg"));
String errorCode = IdentityManagementEndpointUtil.getStringValue(request.getAttribute("errorCode"));
String invalidConfirmationErrorCode = IdentityRecoveryConstants.ErrorMessages.ERROR_CODE_INVALID_CODE.getCode();
String expiredConfirmationErrorCode = IdentityRecoveryConstants.ErrorMessages.ERROR_CODE_EXPIRED_CODE.getCode();
String callback = request.getParameter("callback");
boolean isValidCallback = true;
Expand Down Expand Up @@ -204,10 +205,11 @@
var errorCodeFromParams = "<%=errorCode%>";
var invalidConfirmationErrorCode = "<%=invalidConfirmationErrorCode%>";
var expiredConfirmationErrorCode = "<%=expiredConfirmationErrorCode%>";
// Check if the error is related to the confirmation code being invalid.
// Check if the error is related to the confirmation code being invalid or expired.
// If so, navigate the users to the URL defined in `callback` URL param.
if (errorCodeFromParams === invalidConfirmationErrorCode) {
if (errorCodeFromParams === invalidConfirmationErrorCode || errorCodeFromParams === expiredConfirmationErrorCode) {
window.location.href = "<%=Encode.forHtmlAttribute(callback)%>";
return;
Expand Down

0 comments on commit f59eb30

Please sign in to comment.