Skip to content

A Q&A platform software for teams at any scales. Whether it's a community forum, help center, or knowledge management platform, you can always count on Apache Answer.

fix(settings/account): invalid group specifier name in safari

haitao(lj)adbf71434c6b
diff --git a/ui/src/pages/Users/Settings/Account/components/ModifyEmail/index.tsx b/ui/src/pages/Users/Settings/Account/components/ModifyEmail/index.tsx
index 56ba7cb0..6e597771 100644
--- a/ui/src/pages/Users/Settings/Account/components/ModifyEmail/index.tsx
+++ b/ui/src/pages/Users/Settings/Account/components/ModifyEmail/index.tsx
@@ -7,8 +7,6 @@ import { useToast } from '@/hooks';
import { getLoggedUserInfo, changeEmail } from '@/services';
import { handleFormError } from '@/utils';
-const reg = /(?<=.{2}).+(?=@)/gi;
-
const Index: FC = () => {
const { t } = useTranslation('translation', {
keyPrefix: 'settings.account',
@@ -25,6 +23,7 @@ const Index: FC = () => {
const toast = useToast();
useEffect(() => {
getLoggedUserInfo().then((resp) => {
+ resp.e_mail = '[email protected]';
setUserInfo(resp);
});
}, []);
@@ -91,7 +90,10 @@ const Index: FC = () => {
<Form.Control
type="text"
disabled
- defaultValue={userInfo?.e_mail?.replace(reg, () => '*'.repeat(4))}
+ defaultValue={userInfo?.e_mail?.replace(
+ /(.{2})(.+)(@.+)/i,
+ '$1****$3',
+ )}
/>
</Form.Group>