Skip to content

Commit

Permalink
feat: empty email refinement
Browse files Browse the repository at this point in the history
  • Loading branch information
tomzemp committed Jan 13, 2025
1 parent 38b79c9 commit 4087c37
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 7 deletions.
7 changes: 5 additions & 2 deletions i18n/en.pot
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ msgstr ""
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1)\n"
"POT-Creation-Date: 2025-01-13T13:12:31.582Z\n"
"PO-Revision-Date: 2025-01-13T13:12:31.583Z\n"
"POT-Creation-Date: 2025-01-13T15:15:24.364Z\n"
"PO-Revision-Date: 2025-01-13T15:15:24.364Z\n"

msgid "Never"
msgstr "Never"
Expand Down Expand Up @@ -431,6 +431,9 @@ msgstr ""
"Your email is not verified. Please verify your email to continue using the "
"system."

msgid "Please provide an email and verify it to continue using the system."
msgstr "Please provide an email and verify it to continue using the system."

msgid "Manage personal access tokens"
msgstr "Manage personal access tokens"

Expand Down
3 changes: 3 additions & 0 deletions src/layout/FormFields.component.js
Original file line number Diff line number Diff line change
Expand Up @@ -406,6 +406,9 @@ class FormFields extends Component {
emailUpdated={
this.props?.valueStore?.state?.emailUpdated
}
userEmail={
this.props?.valueStore?.state?.email ?? ''
}
/>
)}
{this.renderFields(this.props.fieldKeys)}
Expand Down
2 changes: 1 addition & 1 deletion src/layout/ModalField.component.js
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ export function ModalField({
<InputField
label={i18n.t('Current email')}
value={
userEmail !== ''
userEmail?.trim() !== ''
? userEmail
: i18n.t('no current email')
}
Expand Down
13 changes: 9 additions & 4 deletions src/layout/VerifyEmailWarning.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { NoticeBox } from '@dhis2/ui'
import PropTypes from 'prop-types'
import React from 'react'

export function VerifyEmailWarning({ config, emailUpdated }) {
export function VerifyEmailWarning({ config, emailUpdated, userEmail }) {
const enforceVerifiedEmail =
config.system?.settings?.settings?.enforceVerifiedEmail ?? false
const emailNotVerified =
Expand All @@ -13,9 +13,13 @@ export function VerifyEmailWarning({ config, emailUpdated }) {
return (
<div className="noticebox-wrapper">
<NoticeBox warning>
{i18n.t(
'Your email is not verified. Please verify your email to continue using the system.'
)}
{userEmail?.trim() !== ''
? i18n.t(
'Your email is not verified. Please verify your email to continue using the system.'
)
: i18n.t(
'Please provide an email and verify it to continue using the system.'
)}
</NoticeBox>
</div>
)
Expand All @@ -38,4 +42,5 @@ VerifyEmailWarning.propTypes = {
}),
}).isRequired,
emailUpdated: PropTypes.bool,
userEmail: PropTypes.string,
}

0 comments on commit 4087c37

Please sign in to comment.