Skip to content

Conversation

@enyachoke
Copy link

@enyachoke enyachoke commented Jun 4, 2025

Requirements

  • This PR has a title that briefly describes the work done including the ticket number. Ensure your PR title includes a conventional commit label (such as feat, fix, or chore, among others). See existing PR titles for inspiration.

For changes to apps

If applicable

  • My work includes tests or is validated by existing tests.
  • I have updated the esm-framework mock to reflect any API changes I have made.

Summary

This is a (WIP) PR introducing 2FA to O3. At the moment it is still work in progress and needs an updated Authentication Module.

Screenshots

image image image

Related Issue

Other

@enyachoke enyachoke marked this pull request as draft June 4, 2025 12:03
};

return (
<form onSubmit={handleSubmit} style={{ maxWidth: 400, margin: '0 auto' }}>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As much as possible, we prefer to keep styles in scss files and pass in a className, rather than using the style attribute.

return (
<form onSubmit={handleSubmit} style={{ maxWidth: 400, margin: '0 auto' }}>
<h2>Login with Secret Question</h2>
<TextInput
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It doesn't seem like we should need to prompt for the username here, since presumably they've already filled this in.

return response;
})
.then((response) => {
if (response.headers.has('location')) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd probably check the followRedirects setting here too, even though it's necessary for the feature to work.


return (
<form onSubmit={handleSubmit} style={{ maxWidth: 400, margin: '0 auto' }}>
<h2>Login with Secret Question</h2>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be translated.

value={username}
onChange={(e) => setUsername(e.target.value)}
required
/>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We also should not prompt the user for their Secret Question here - this is something that is stored in their user profile, not something they enter in. So ideally we would retrieve this via REST and (if needed) pass it back to the backend as a hidden input. The user should not need to enter or remember this question text.

/>
<TextInput
id="answer"
labelText="Answer"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would think that the label text for the answer should just be the value of the secret question, no? If we do want to have text called "Answer", then this should be translated.

required
/>
<Button type="submit" style={{ marginTop: 16 }}>
Login
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be translated and css externalized

title="Error"
subtitle={error}
onCloseButtonClick={() => setError(null)}
style={{ marginTop: 16 }}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be translated and css externalized

setTimeout(() => navigate('/login/location'), 0);
}
} else {
setError('Invalid MFA code');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be translated

setTotp('');
}
} catch (error) {
setError(error instanceof Error ? error.message : 'Failed to verify MFA code');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be translated

<Logo t={t} />
</div>
<form onSubmit={handleSubmit}>
<div className={styles.inputGroup}>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My guess is that we may want some kind of instructions / help text here that can remind a user how to log in with TOTP.

<HeaderGlobalAction aria-label={t('setupMfa', 'Setup 2FA')} className={styles.setupMfaButton} onClick={setupTotp}>
<TwoFactorAuthentication size={20} />
<span className={styles.setupMfaText}>{t('setupMfa', 'Setup 2FA')}</span>
</HeaderGlobalAction>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess this is fine for now, but doesn't seem ideal:
a) This is hard-coded to go to totp-seup, but is called Setup 2FA. What about secret question support?
b) We really need a page for a user to view their account settings, and to self-manage their account, beyond just using links in the header that is directly accessible from everywhere. I would be more inclined to add the ability to configure one's authentication methods via a user account page, rather than the header. Not sure if anything like this has been designed out (and also out of scope) but something to think about. @ibacher ?

<Route path="logout" element={<RedirectLogout />} />
<Route path="change-password" element={<ChangePassword />} />
<Route path="login/totp" element={<LoginWithTotp />} />
<Route path="totp-setup" element={<TOTPSetup />} />
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See my comments above about how I feel about this menu. Also, what is the use case for having LoginWithTotp available in the header? Doesn't the user need to already be logged in to see this?

@denniskigen denniskigen changed the title (feat) Adds support forTOTP 2FA to O3. (feat) Adds support for TOTP 2FA to O3 Jun 17, 2025
@denniskigen denniskigen changed the title (feat) Adds support for TOTP 2FA to O3 (feat) Add support for TOTP 2FA to O3 Jun 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants