feat: always propose to register a secret in an authenticator app when email or auth app OTP enforcement strategy is configured#663
Merged
Conversation
…n email or auth app OTP enforcement strategy is configured
Contributor
There was a problem hiding this comment.
Pull request overview
This PR modifies the 2FA enforcement flow so that when email-based OTP enforcement is configured, users are always presented with the option to register a secret in an authenticator app (via QR code) in addition to receiving an OTP code by email. Previously, these were mutually exclusive — if email enforcement was configured, only the email OTP was offered. The dependency obiba-commons is also bumped from 5.0.0 to 5.0.1.
Changes:
- Backend logic in
SessionsResourceandTicketsResourcenow always generates a temp secret (QR code) when 2FA is enforced without a user secret, and additionally sends an email OTP if the email strategy is configured, returning both in the response. AgateUserRealmupdated to accept email OTP as a fallback when a user has a temp secret but enters an email-based code instead of a TOTP code from the authenticator app.- Frontend templates and i18n updated to show email OTP instructions alongside the QR code when the email option is available.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
pom.xml |
Bumps obiba-commons version from 5.0.0 to 5.0.1 |
agate-rest/.../TicketsResource.java |
Always creates temp secret and conditionally appends email OTP info |
agate-rest/.../SessionsResource.java |
Same logic change as TicketsResource for session-based login |
agate-core/.../AgateUserRealm.java |
Adds email OTP validation fallback when temp secret TOTP fails |
agate-webapp/.../signin.ftl |
Adds UI element for email OTP instructions |
agate-webapp/.../signin-scripts.ftl |
Shows/hides email instructions based on response |
agate-webapp/.../models/index.ftl |
Wraps 2FA info alerts with otpEnforced check to suppress when enforced |
agate-webapp/.../SessionInterceptor.java |
Exposes otpEnforced flag to template model |
agate-webapp/.../messages_en.properties |
Adds English email OTP instruction message |
agate-webapp/.../messages_fr.properties |
Adds French email OTP instruction message |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.