Skip to content

feat: always propose to register a secret in an authenticator app when email or auth app OTP enforcement strategy is configured#663

Merged
ymarcon merged 3 commits into
masterfrom
feat/661
Mar 14, 2026
Merged

feat: always propose to register a secret in an authenticator app when email or auth app OTP enforcement strategy is configured#663
ymarcon merged 3 commits into
masterfrom
feat/661

Conversation

@ymarcon
Copy link
Copy Markdown
Member

@ymarcon ymarcon commented Mar 13, 2026

image

…n email or auth app OTP enforcement strategy is configured
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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 SessionsResource and TicketsResource now 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.
  • AgateUserRealm updated 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.

Comment thread agate-rest/src/main/java/org/obiba/agate/web/rest/ticket/TicketsResource.java Outdated
Comment thread agate-rest/src/main/java/org/obiba/agate/web/rest/security/SessionsResource.java Outdated
@ymarcon ymarcon merged commit be65260 into master Mar 14, 2026
2 checks passed
@ymarcon ymarcon deleted the feat/661 branch March 14, 2026 10:02
@ymarcon ymarcon mentioned this pull request Mar 14, 2026
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.

2 participants