Updated wording in the support email verification process (#19187)

fixes GRO-87

- also updated logic to use the calculated "support_email_address" in Portal settings
This commit is contained in:
Sag 2023-11-30 11:58:12 -03:00 committed by GitHub
parent 1b75747ca0
commit 4cc615a5d3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 11 deletions

View File

@ -8,14 +8,13 @@ const AccountPage: React.FC<{
updateSetting: (key: string, setting: SettingValue) => void
}> = ({updateSetting}) => {
const {siteData, settings, config} = useGlobalData();
const [membersSupportAddress] = getSettingValues(settings, ['members_support_address']);
const [membersSupportAddress, supportEmailAddress] = getSettingValues(settings, ['members_support_address', 'support_email_address']);
const calculatedSupportAddress = supportEmailAddress?.toString() || fullEmailAddress(membersSupportAddress?.toString() || '', siteData!, config);
const emailDomain = getEmailDomain(siteData!, config);
const [value, setValue] = useState(fullEmailAddress(membersSupportAddress?.toString() || '', siteData!, config));
const [value, setValue] = useState(calculatedSupportAddress);
const updateSupportAddress: FocusEventHandler<HTMLInputElement> = (e) => {
let supportAddress = e.target.value;
let settingValue = emailDomain && supportAddress === `noreply@${emailDomain}` ? 'noreply' : supportAddress;
updateSetting('members_support_address', settingValue);
@ -23,8 +22,8 @@ const AccountPage: React.FC<{
};
useEffect(() => {
setValue(fullEmailAddress(membersSupportAddress?.toString() || '', siteData!, config));
}, [membersSupportAddress, siteData]);
setValue(calculatedSupportAddress);
}, [calculatedSupportAddress]);
return <div className='mt-7'><Form>
<TextField title='Support email address' value={value} onBlur={updateSupportAddress} onChange={e => setValue(e.target.value)} />

View File

@ -84,8 +84,8 @@ const PortalModal: React.FC = () => {
let {settings: verifiedSettings} = await verifyToken({token});
const [supportEmail] = getSettingValues<string>(verifiedSettings, ['members_support_address']);
NiceModal.show(ConfirmationModal, {
title: 'Verifying email address',
prompt: <>Success! The support email address has changed to <strong>{supportEmail}</strong></>,
title: 'Support address verified',
prompt: <>Your support email address has been changed to <strong>{supportEmail}</strong>.</>,
okLabel: 'Close',
cancelLabel: '',
onOk: confirmModal => confirmModal?.remove()
@ -98,7 +98,7 @@ const PortalModal: React.FC = () => {
prompt = 'The verification link has expired. Please try again.';
}
NiceModal.show(ConfirmationModal, {
title: 'Error verifying email address',
title: 'Error verifying support address',
prompt: prompt,
okLabel: 'Close',
cancelLabel: '',
@ -135,13 +135,14 @@ const PortalModal: React.FC = () => {
if (meta?.sent_email_verification) {
const newEmail = formState.settings.find(setting => setting.key === 'members_support_address')?.value;
const currentEmail = currentSettings.find(setting => setting.key === 'members_support_address')?.value;
const currentEmail = currentSettings.find(setting => setting.key === 'support_email_address')?.value ||
fullEmailAddress(currentSettings.find(setting => setting.key === 'members_support_address')?.value?.toString() || 'noreply', siteData!, config);
NiceModal.show(ConfirmationModal, {
title: 'Confirm email address',
prompt: <>
We&apos;ve sent a confirmation email to <strong>{newEmail}</strong>.
Until verified, your support address will remain {fullEmailAddress(currentEmail?.toString() || 'noreply', siteData!, config)}.
Until verified, your support email address will remain {currentEmail}.
</>,
okLabel: 'Close',
cancelLabel: '',