mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-20 22:42:53 -05:00
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.
This commit is contained in:
parent
a6c6114e6f
commit
dfb0f93c06
1 changed files with 4 additions and 2 deletions
|
@ -1,4 +1,5 @@
|
||||||
import React, {FocusEventHandler, useEffect, useState} from 'react';
|
import React, {FocusEventHandler, useEffect, useState} from 'react';
|
||||||
|
import validator from 'validator';
|
||||||
import {Form, TextField} from '@tryghost/admin-x-design-system';
|
import {Form, TextField} from '@tryghost/admin-x-design-system';
|
||||||
import {SettingValue, getSettingValues} from '@tryghost/admin-x-framework/api/settings';
|
import {SettingValue, getSettingValues} from '@tryghost/admin-x-framework/api/settings';
|
||||||
import {fullEmailAddress, getEmailDomain} from '@tryghost/admin-x-framework/api/site';
|
import {fullEmailAddress, getEmailDomain} from '@tryghost/admin-x-framework/api/site';
|
||||||
|
@ -19,8 +20,9 @@ const AccountPage: React.FC<{
|
||||||
let supportAddress = e.target.value;
|
let supportAddress = e.target.value;
|
||||||
|
|
||||||
if (!supportAddress) {
|
if (!supportAddress) {
|
||||||
setError('members_support_address', 'Please enter an email address');
|
setError('members_support_address', 'Enter an email address');
|
||||||
return;
|
} else if (!validator.isEmail(supportAddress)) {
|
||||||
|
setError('members_support_address', 'Enter a valid email address');
|
||||||
} else {
|
} else {
|
||||||
setError('members_support_address', '');
|
setError('members_support_address', '');
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue