MCPcopy Create free account
hub / github.com/aiprodcoder/MIXAPI / handleAddEmail

Function handleAddEmail

web/src/components/settings/SystemSetting.js:259–281  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

257 };
258
259 const handleAddEmail = () => {
260 if (emailToAdd && emailToAdd.trim() !== '') {
261 const domain = emailToAdd.trim();
262
263 // 验证域名格式
264 const domainRegex =
265 /^([a-zA-Z0-9]([a-zA-Z0-9\-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$/;
266 if (!domainRegex.test(domain)) {
267 showError(t('邮箱域名格式不正确,请输入有效的域名,如 gmail.com'));
268 return;
269 }
270
271 // 检查是否已存在
272 if (emailDomainWhitelist.includes(domain)) {
273 showError(t('该域名已存在于白名单中'));
274 return;
275 }
276
277 setEmailDomainWhitelist([...emailDomainWhitelist, domain]);
278 setEmailToAdd('');
279 showSuccess(t('已添加到白名单'));
280 }
281 };
282
283 const submitWeChat = async () => {
284 const options = [];

Callers

nothing calls this directly

Calls 3

showErrorFunction · 0.90
showSuccessFunction · 0.90
tFunction · 0.70

Tested by

no test coverage detected