From 2255a98a61ad448775b0f4a43039d8e4d7dc1c2a Mon Sep 17 00:00:00 2001 From: ektaghag-eaton Date: Wed, 13 Sep 2023 13:28:39 +0530 Subject: [PATCH 1/2] Fix change password dialog props --- .../example/src/components/ChangePassword.tsx | 4 ++++ .../ChangePasswordDialog.tsx | 21 ++++++++++++------- 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/login-workflow/example/src/components/ChangePassword.tsx b/login-workflow/example/src/components/ChangePassword.tsx index ea145a38..e5aa756a 100644 --- a/login-workflow/example/src/components/ChangePassword.tsx +++ b/login-workflow/example/src/components/ChangePassword.tsx @@ -16,6 +16,10 @@ export const ChangePassword = (): JSX.Element => { return ( { + console.log('Print Current Password', currentPassword); + }} + loading={false} open={app.showChangePasswordDialog} onPrevious={(): void => app.setShowChangePasswordDialog(false)} onSubmit={(): void => app.setShowChangePasswordDialog(false)} diff --git a/login-workflow/src/components/ChangePasswordDialog/ChangePasswordDialog.tsx b/login-workflow/src/components/ChangePasswordDialog/ChangePasswordDialog.tsx index c3465c7c..58bec318 100644 --- a/login-workflow/src/components/ChangePasswordDialog/ChangePasswordDialog.tsx +++ b/login-workflow/src/components/ChangePasswordDialog/ChangePasswordDialog.tsx @@ -31,13 +31,6 @@ export const ChangePasswordDialog: React.FC = (props) const { t } = useLanguageLocale(); const passwordRef = useRef(null); const confirmRef = useRef(null); - const [currentInput, setCurrentInput] = useState(''); - const [passwordInput, setPasswordInput] = useState(''); - const [confirmInput, setConfirmInput] = useState(''); - const [showErrorDialog, setShowErrorDialog] = useState(false); - const [isLoading, setIsLoading] = useState(false); - const [showSuccessScreen, setShowSuccessScreen] = useState(false); - const { actions } = useAuthContext(); const { open, @@ -50,8 +43,17 @@ export const ChangePasswordDialog: React.FC = (props) onFinish, PasswordProps, ErrorDialogProps, + loading, } = props; + const [currentInput, setCurrentInput] = useState(''); + const [passwordInput, setPasswordInput] = useState(''); + const [confirmInput, setConfirmInput] = useState(''); + const [showErrorDialog, setShowErrorDialog] = useState(false); + const [isLoading, setIsLoading] = useState(loading); + const [showSuccessScreen, setShowSuccessScreen] = useState(false); + const { actions } = useAuthContext(); + const passwordRequirements = defaultPasswordRequirements(t); const updateFields = useCallback( @@ -129,7 +131,10 @@ export const ChangePasswordDialog: React.FC = (props) currentPasswordLabel={currentPasswordLabel} previousLabel={previousLabel} nextLabel={nextLabel} - currentPasswordChange={(currentPwd): void => setCurrentInput(currentPwd)} + currentPasswordChange={(currentPwd): void => { + setCurrentInput(currentPwd); + props?.currentPasswordChange?.(currentPwd); + }} enableButton={checkPasswords} onPrevious={onPrevious} onSubmit={async (): Promise => { From 5a757726d391d3b63e0509cae2973d4cef91c235 Mon Sep 17 00:00:00 2001 From: ektaghag-eaton Date: Wed, 13 Sep 2023 13:31:14 +0530 Subject: [PATCH 2/2] revert chabges --- login-workflow/example/src/components/ChangePassword.tsx | 4 ---- 1 file changed, 4 deletions(-) diff --git a/login-workflow/example/src/components/ChangePassword.tsx b/login-workflow/example/src/components/ChangePassword.tsx index e5aa756a..ea145a38 100644 --- a/login-workflow/example/src/components/ChangePassword.tsx +++ b/login-workflow/example/src/components/ChangePassword.tsx @@ -16,10 +16,6 @@ export const ChangePassword = (): JSX.Element => { return ( { - console.log('Print Current Password', currentPassword); - }} - loading={false} open={app.showChangePasswordDialog} onPrevious={(): void => app.setShowChangePasswordDialog(false)} onSubmit={(): void => app.setShowChangePasswordDialog(false)}