From dfb0f93c064bdf070f358eecfb832cbad4840547 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dani=C3=ABl=20van=20der=20Winden?= Date: Mon, 8 Jul 2024 16:16:38 +0200 Subject: [PATCH] Updated support email error messages (#20558) Fixes https://linear.app/tryghost/issue/DES-537/inconsistent-error-messages-for-invalid-email We were showing inconsistent error messages when changing the support email address in Portal settings. They are now consistently shown inline, rather than in a toast. --- .../components/settings/membership/portal/AccountPage.tsx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/apps/admin-x-settings/src/components/settings/membership/portal/AccountPage.tsx b/apps/admin-x-settings/src/components/settings/membership/portal/AccountPage.tsx index 01e6d23c6e..cd72dee9cf 100644 --- a/apps/admin-x-settings/src/components/settings/membership/portal/AccountPage.tsx +++ b/apps/admin-x-settings/src/components/settings/membership/portal/AccountPage.tsx @@ -1,4 +1,5 @@ import React, {FocusEventHandler, useEffect, useState} from 'react'; +import validator from 'validator'; import {Form, TextField} from '@tryghost/admin-x-design-system'; import {SettingValue, getSettingValues} from '@tryghost/admin-x-framework/api/settings'; import {fullEmailAddress, getEmailDomain} from '@tryghost/admin-x-framework/api/site'; @@ -19,8 +20,9 @@ const AccountPage: React.FC<{ let supportAddress = e.target.value; if (!supportAddress) { - setError('members_support_address', 'Please enter an email address'); - return; + setError('members_support_address', 'Enter an email address'); + } else if (!validator.isEmail(supportAddress)) { + setError('members_support_address', 'Enter a valid email address'); } else { setError('members_support_address', ''); }