mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-25 03:44:29 +03:00
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:
parent
1b75747ca0
commit
4cc615a5d3
@ -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)} />
|
||||
|
@ -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'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: '',
|
||||
|
Loading…
Reference in New Issue
Block a user