Skip to content

Improved text for email MFA requests#22545

Merged
sam-lord merged 1 commit intomainfrom
2fa-text-changes
Mar 18, 2025
Merged

Improved text for email MFA requests#22545
sam-lord merged 1 commit intomainfrom
2fa-text-changes

Conversation

@sam-lord
Copy link
Contributor

ref ENG-2074

The email text can be changed based on whether the verification code is available, but the messages in Ghost Admin can't as they rely on the settings API (which is authenticated). Instead they're simplified to remove the content about an unrecognised device, which could be incorrect if 2FA is required for every login.

ref ENG-2074

The email text can be changed based on whether the verification code
is available, but the messages in Ghost Admin can't as they rely on
the settings API (which is authenticated). Instead they're simplified
to remove the content about an unrecognised device, which could be
incorrect if 2FA is required for every login.
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 18, 2025

Walkthrough

The changes remove the "We don't recognize this device." message from both the re-verification modal and the sign-in verification template, simplifying the user text regarding the verification process. A new boolean attribute, requireEmailMfa, has been added to the settings model under a "Security settings" section. In addition, the email template has been updated with a new parameter, is2FARequired, which conditionally alters the sign-in message to reflect two-factor authentication requirements. The session service now returns an is2FARequired property that is sourced from the settings cache, aligning session information with the new security setting. Minor formatting adjustments, such as an added blank line, have also been applied.

Suggested labels

browser-tests, migration

Warning

There were issues while running some tools. Please review the errors and either fix the tool’s configuration or disable the tool if it’s a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ghost/admin/app/models/setting.js

Oops! Something went wrong! :(

ESLint: 8.44.0

Error: Failed to load parser '@babel/eslint-parser' declared in 'ghost/admin/.eslintrc.js': Cannot find module '@babel/eslint-parser'
Require stack:

  • /ghost/admin/.eslintrc.js
    at Module._resolveFilename (node:internal/modules/cjs/loader:1248:15)
    at Function.resolve (node:internal/modules/helpers:145:19)
    at Object.resolve (/node_modules/@eslint/eslintrc/dist/eslintrc.cjs:2346:46)
    at ConfigArrayFactory._loadParser (/node_modules/@eslint/eslintrc/dist/eslintrc.cjs:3325:39)
    at ConfigArrayFactory._normalizeObjectConfigDataBody (/node_modules/@eslint/eslintrc/dist/eslintrc.cjs:3099:43)
    at _normalizeObjectConfigDataBody.next ()
    at ConfigArrayFactory._normalizeObjectConfigData (/node_modules/@eslint/eslintrc/dist/eslintrc.cjs:3040:20)
    at _normalizeObjectConfigData.next ()
    at ConfigArrayFactory.loadInDirectory (/node_modules/@eslint/eslintrc/dist/eslintrc.cjs:2886:28)
    at CascadingConfigArrayFactory._loadConfigInAncestors (/node_modules/@eslint/eslintrc/dist/eslintrc.cjs:3871:46)

Tip

⚡🧪 Multi-step agentic review comment chat (experimental)
  • We're introducing multi-step agentic chat in review comments. This experimental feature enhances review discussions with the CodeRabbit agentic chat by enabling advanced interactions, including the ability to create pull requests directly from comments.
    - To enable this feature, set early_access to true under in the settings.

📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between dc39bd1 and 971c1e1.

📒 Files selected for processing (5)
  • ghost/admin/app/components/editor/modals/re-verify.hbs (0 hunks)
  • ghost/admin/app/models/setting.js (1 hunks)
  • ghost/admin/app/templates/signin-verify.hbs (1 hunks)
  • ghost/session-service/lib/emails/signin.js (2 hunks)
  • ghost/session-service/lib/session-service.js (1 hunks)
💤 Files with no reviewable changes (1)
  • ghost/admin/app/components/editor/modals/re-verify.hbs
⏰ Context from checks skipped due to timeout of 90000ms (11)
  • GitHub Check: Ghost-CLI tests
  • GitHub Check: Regression tests (Node 20.11.1, sqlite3)
  • GitHub Check: Database tests (Node 20.11.1, sqlite3)
  • GitHub Check: Regression tests (Node 20.11.1, mysql8)
  • GitHub Check: Database tests (Node 22.13.1, mysql8)
  • GitHub Check: Database tests (Node 20.11.1, mysql8)
  • GitHub Check: Unit tests (Node 22.13.1)
  • GitHub Check: Database tests (Node 18.12.1, mysql8)
  • GitHub Check: Unit tests (Node 20.11.1)
  • GitHub Check: Unit tests (Node 18.12.1)
  • GitHub Check: Admin tests - Chrome
🔇 Additional comments (7)
ghost/admin/app/models/setting.js (2)

119-122: New security settings section looks good

The addition of a new section for "Security settings" is clean and well-organized, following the existing pattern in the model.


119-123: Boolean attribute for MFA requirement added correctly

The requireEmailMfa attribute is properly defined as a boolean type and follows the naming convention used throughout the file.

ghost/admin/app/templates/signin-verify.hbs (2)

10-12: Successfully simplified verification message

Removed the "We don't recognize this device" message from the verification screen, which aligns with the PR objective to avoid potentially inaccurate statements when MFA might be required for every login.


58-58: Minor formatting improvement

Added a blank line for better readability before the closing form tag.

ghost/session-service/lib/session-service.js (1)

263-264: Added 2FA requirement property to email template context

The is2FARequired property is properly retrieved from the settings cache and passed to the email template, allowing for conditional messaging based on whether MFA is required for all logins.

ghost/session-service/lib/emails/signin.js (2)

1-1: Updated function signature to include 2FA requirement parameter

The function signature has been expanded to include the is2FARequired parameter, which is needed for the conditional message rendering.


123-123: Improved email text with conditional device recognition message

The email template now conditionally includes the "You just tried to access your account from a new device" message only when 2FA is specifically required (not when it's mandatory for all logins). This makes the messaging more accurate in all scenarios.

✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@sam-lord sam-lord merged commit 3243140 into main Mar 18, 2025
26 checks passed
@sam-lord sam-lord deleted the 2fa-text-changes branch March 18, 2025 16:34
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.

1 participant