Skip to content

feat: update enforce verified email checkbox#1414

Merged
Chisomchima merged 4 commits intomasterfrom
DHIS2-18789/restrict-enforce-verified-email
Jan 21, 2025
Merged

feat: update enforce verified email checkbox#1414
Chisomchima merged 4 commits intomasterfrom
DHIS2-18789/restrict-enforce-verified-email

Conversation

@Chisomchima
Copy link
Member

@Chisomchima Chisomchima commented Jan 16, 2025

Implement Email Configuration Check for enforceVerifiedEmail Setting

Description:

This PR introduces the following changes to the SettingsFields component for this issue:

  1. enforceVerifiedEmail Setting Email Configuration Check:

    • The checkbox for enforceVerifiedEmail is now conditionally enabled. It can only be checked (set to true) if the system has email configuration (keyEmailHostName and keyEmailUserName are both set).
    • If email settings are missing, the checkbox is disabled, and an explanatory text is displayed to inform the user that email configuration is required for this setting to work.
    • If the email settings are missing, the enforceVerifiedEmail setting can only be set to false.
  2. Fixing ESLint no-case-declarations Errors:

    • Wrapped the contents of each switch case block in curly braces {} to resolve ESLint warnings/errors regarding lexical declarations (const, let, etc.) inside switch statements. This ensures proper scoping and avoids the error: Unexpected lexical declaration in case block.

Motivation and Context:

  • The purpose of the first change is to ensure that the enforceVerifiedEmail setting can only be enabled when email configuration is properly set up, preventing confusion or errors if the email system is not properly configured.

Changes Made:

  • Added a conditional check to enable/disable the enforceVerifiedEmail checkbox based on the presence of email configuration (keyEmailHostName and keyEmailUserName).
  • Displayed explanatory text for enforceVerifiedEmail to clarify that email configuration is required to enable this setting.
  • Adjusted some logic to handle edge cases for settings that require email configuration.

@dhis2-bot
Copy link
Contributor

dhis2-bot commented Jan 16, 2025

🚀 Deployed on https://pr-1414--dhis2-settings.netlify.app

@dhis2-bot dhis2-bot temporarily deployed to netlify January 16, 2025 13:03 Inactive
@dhis2-bot dhis2-bot temporarily deployed to netlify January 16, 2025 13:04 Inactive
@Chisomchima Chisomchima requested a review from tomzemp January 17, 2025 11:39
@dhis2-bot dhis2-bot temporarily deployed to netlify January 17, 2025 11:40 Inactive
Copy link
Member

@tomzemp tomzemp left a comment

Choose a reason for hiding this comment

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

Looks good 🎊🎊

FYI: The snackbar message gets cut off when you try to enable the enforce verified emails setting without having email configured:
image

You could just have the button disabled in this state (the explanatory text explains why it's disabled), or you could shorten the snackbar message (maybe "Cannot update as email is not configured")

@Chisomchima Chisomchima merged commit 5901409 into master Jan 21, 2025
5 checks passed
@Chisomchima Chisomchima deleted the DHIS2-18789/restrict-enforce-verified-email branch January 21, 2025 10:53
@dhis2-bot
Copy link
Contributor

🎉 This PR is included in version 100.4.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants