-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1458 from dhis2/DHIS2-18376/verify-email-warning
feat: verify email warning
- Loading branch information
Showing
5 changed files
with
71 additions
and
3 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import i18n from '@dhis2/d2-i18n' | ||
import { NoticeBox } from '@dhis2/ui' | ||
import PropTypes from 'prop-types' | ||
import React from 'react' | ||
|
||
export function VerifyEmailWarning({ config }) { | ||
const enforceVerifiedEmail = | ||
config.system?.settings?.settings?.enforceVerifiedEmail || false | ||
const emailVerified = config.currentUser?.emailVerified || false | ||
|
||
if (enforceVerifiedEmail && !emailVerified) { | ||
return ( | ||
<div className="noticebox-wrapper"> | ||
<NoticeBox warning> | ||
{i18n.t( | ||
'Your email is not verified. Please verify your email to continue using the system.' | ||
)} | ||
</NoticeBox> | ||
</div> | ||
) | ||
} | ||
|
||
return null | ||
} | ||
|
||
VerifyEmailWarning.propTypes = { | ||
config: PropTypes.shape({ | ||
currentUser: PropTypes.shape({ | ||
emailVerified: PropTypes.bool, | ||
}), | ||
system: PropTypes.shape({ | ||
settings: PropTypes.shape({ | ||
settings: PropTypes.shape({ | ||
enforceVerifiedEmail: PropTypes.bool, | ||
}), | ||
}), | ||
}), | ||
}).isRequired, | ||
} |
This file contains 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
30db2f2
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎉 Published on https://dhis2-user-profile.netlify.app as production
🚀 Deployed on https://677e1cd317e31d0a137ba709--dhis2-user-profile.netlify.app