Skip to content

Commit

Permalink
Merge pull request #1984 from SUNET/eunju-info-text-modal
Browse files Browse the repository at this point in the history
Inform the user what will happen after logging in
  • Loading branch information
cartja authored Jan 29, 2025
2 parents 031a92c + 402028f commit ec22823
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 6 deletions.
11 changes: 6 additions & 5 deletions src/components/Common/MultiFactorAuthentication.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -439,8 +439,8 @@ function SecurityKeyTable({ handleVerifyWebauthnTokenBankID, handleVerifyWebauth
})();
}, [authn?.response?.frontend_action]);

async function handleConfirmDeleteModal(credential_key: string) {
credentialKey.current = credential_key;
async function handleConfirmDeleteModal(cred: CredentialType) {
credentialKey.current = JSON.stringify({ credential: cred.key, description: cred.description });
// Test if the user can directly execute the action or a re-auth security zone will be required
// If no re-auth is required, then show the modal to confirm the removal
// else show the re-auth modal and do now show the confirmation modal (show only 1 modal)
Expand All @@ -454,13 +454,14 @@ function SecurityKeyTable({ handleVerifyWebauthnTokenBankID, handleVerifyWebauth

async function handleRemoveWebauthnToken() {
setShowConfirmRemoveSecurityKeyModal(false);
const response = await dispatch(removeWebauthnToken({ credential_key: credentialKey.current as string }));
const parsedFrontendState = credentialKey.current && JSON.parse(credentialKey.current);
const response = await dispatch(removeWebauthnToken({ credential_key: parsedFrontendState.credential as string }));
if (removeWebauthnToken.rejected.match(response)) {
// prepare authenticate() and AuthenticateModal
dispatch(
authnSlice.actions.setFrontendActionAndState({
frontend_action: "removeSecurityKeyAuthn",
frontend_state: credentialKey.current as string,
frontend_state: JSON.stringify(parsedFrontendState),
})
);
}
Expand Down Expand Up @@ -531,7 +532,7 @@ function SecurityKeyTable({ handleVerifyWebauthnTokenBankID, handleVerifyWebauth
id="remove-webauthn"
buttonstyle="remove"
size="sm"
onClick={() => handleConfirmDeleteModal(cred.key)}
onClick={() => handleConfirmDeleteModal(cred)}
></EduIDButton>
</div>
<div>
Expand Down
21 changes: 20 additions & 1 deletion src/components/Dashboard/AuthenticateModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export function AuthenticateModal() {
defaultMessage="You need to log in again to perform the requested action."
/>
<br />
{securityKeyDescription && (
{frontend_action === "verifyCredentials" && (
<p className="help-text">
<FormattedMessage
description="security zone modal"
Expand All @@ -72,6 +72,25 @@ export function AuthenticateModal() {
/>
</p>
)}
{frontend_action === "removeSecurityKeyAuthn" && (
<p className="help-text">
<FormattedMessage
description="security zone modal"
defaultMessage="Note: Your security key {securityKeyDescription} will be removed after you log in."
values={{
securityKeyDescription: <strong>{securityKeyDescription}</strong>,
}}
/>
</p>
)}
{frontend_action === "removeIdentity" && (
<p className="help-text">
<FormattedMessage
description="security zone modal"
defaultMessage="Note: continuing will disconnect your real identity from your eduID after you log in."
/>
</p>
)}
</Fragment>
}
showModal={re_authenticate}
Expand Down
8 changes: 8 additions & 0 deletions src/translation/extractedMessages.json
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,10 @@
"developer_comment": "login eduid - other devices list item 3",
"string": "on that second device, review the device requesting to be logged in and use the presented code to login by entering it within the time shown, in the first device."
},
"54jpQ0": {
"developer_comment": "security zone modal",
"string": "Note: Your security key {securityKeyDescription} will be removed after you log in."
},
"56tvVG": {
"developer_comment": "which verification methods - paragraph2",
"string": "Note: you can remove a verified identity connected to your eduID in the Identity area."
Expand Down Expand Up @@ -1667,6 +1671,10 @@
"developer_comment": "how to contact support phone",
"string": ", but for simple matters you can also reach us on phone number"
},
"b7rKTd": {
"developer_comment": "security zone modal",
"string": "Note: continuing will disconnect your real identity from your eduID after you log in."
},
"bCY5Fs": {
"developer_comment": "Use another device IP proximity",
"string": "(Close to your address now)"
Expand Down

0 comments on commit ec22823

Please sign in to comment.