From e093bb09bbf1e877f26e6f574c9d0ebbc8ac7f19 Mon Sep 17 00:00:00 2001 From: MadhuMosip Date: Thu, 19 Sep 2024 13:02:37 +0530 Subject: [PATCH] MOSIP-35899 Added success message for reset password Signed-off-by: MadhuMosip --- .../login/pages/LoginUpdatePassword.tsx | 45 ++++++++++++++----- 1 file changed, 33 insertions(+), 12 deletions(-) diff --git a/keycloak-artemis/mosip_keycloak_theme/src/keycloak-theme/login/pages/LoginUpdatePassword.tsx b/keycloak-artemis/mosip_keycloak_theme/src/keycloak-theme/login/pages/LoginUpdatePassword.tsx index 973c231f..cf9e8801 100644 --- a/keycloak-artemis/mosip_keycloak_theme/src/keycloak-theme/login/pages/LoginUpdatePassword.tsx +++ b/keycloak-artemis/mosip_keycloak_theme/src/keycloak-theme/login/pages/LoginUpdatePassword.tsx @@ -22,7 +22,7 @@ export default function LoginUpdatePassword(props: PageProps({"password-new":"", "password-confirm":""}); + const [newPasswordData, getNewPasswordData] = useState({ "password-new": "", "password-confirm": "" }); const [isSamePassword, checkisSamePassword] = useState(false); const [openErrTab, getOpenErrTab] = useState(true); @@ -39,11 +39,11 @@ export default function LoginUpdatePassword(props: PageProps{ - const {name, value} = event.target - getNewPasswordData(prevData =>({ + const capturePassWordData = (event: any) => { + const { name, value } = event.target + getNewPasswordData(prevData => ({ ...prevData, - [name]:value + [name]: value })) if (name === 'password-confirm' && newPasswordData['password-new']) { @@ -62,8 +62,22 @@ export default function LoginUpdatePassword(props: PageProps { + setReloadBtn(true); + } + + // const moveToDashBoard = () => { + // const formElement = document.getElementById("kc-passwd-update-form") as HTMLFormElement | null; + + // if (formElement) { + // formElement.action = url.loginAction; + // } else { + // console.error("Form element not found"); + // } + // } + + window.onbeforeunload = function () { + if (!isReloadBtn && !localStorage.getItem("isLocaleopen")) { return 'Do you want to leave this page?' } } @@ -79,13 +93,13 @@ export default function LoginUpdatePassword(props: PageProps } > -
+ {!isReloadBtn && {(message !== undefined && message.type !== 'warning' && openErrTab) && (
{/* {message.type === "success" && } {message.type === "warning" && } {message.type === "info" && } */} - getOpenErrTab(!openErrTab)} className="h-4 w-4 float-right cursor-pointer" alt=""src={closeIcon} /> + getOpenErrTab(!openErrTab)} className="h-4 w-4 float-right cursor-pointer" alt="" src={closeIcon} /> setReloadBtn(true)} + // type="submit" + // onClick={() => setReloadBtn(true)} + onClick={showSuccessMsg} value={msgStr("doSubmit")} disabled={!newPasswordData['password-new'] || !newPasswordData['password-confirm'] || isSamePassword} /> )}
-
+ } + {isReloadBtn && +
+

Email verification successful!

+ +
+ } ); }