feat: add email regex validation for user registration (#835)

This commit is contained in:
Dream Hunter
2026-02-16 12:40:20 +08:00
committed by GitHub
parent 56351ed963
commit bde08b9d55
6 changed files with 47 additions and 1 deletions

View File

@@ -21,6 +21,8 @@ const { t } = useI18n({
manualInputPrompt: 'Type and press Enter to add',
mailAllowList: 'Mail Address Allow List',
maxAddressCount: 'Maximum number of email addresses that can be binded',
emailCheckRegex: 'Email Check Regex (e.g. ^[^.]+@.+$ to disallow dots before @)',
enableEmailCheckRegex: 'Enable Email Check Regex',
},
zh: {
save: '保存',
@@ -33,6 +35,8 @@ const { t } = useI18n({
manualInputPrompt: '输入后按回车键添加',
mailAllowList: '邮件地址白名单',
maxAddressCount: '可绑定最大邮箱地址数量',
emailCheckRegex: '邮箱正则校验 (例如 ^[^.]+@.+$ 禁止@前面有.)',
enableEmailCheckRegex: '启用邮箱正则校验',
}
}
});
@@ -53,6 +57,8 @@ const userSettings = ref({
enableMailAllowList: false,
mailAllowList: commonMail,
maxAddressCount: 5,
enableEmailCheckRegex: false,
emailCheckRegex: "",
});
const fetchData = async () => {
@@ -125,6 +131,16 @@ onMounted(async () => {
:placeholder="t('maxAddressCount')" />
</n-input-group>
</n-form-item-row>
<n-form-item-row :label="t('enableEmailCheckRegex')">
<n-input-group>
<n-checkbox v-model:checked="userSettings.enableEmailCheckRegex" style="width: 20%;">
{{ t('enable') }}
</n-checkbox>
<n-input v-model:value="userSettings.emailCheckRegex"
v-if="userSettings.enableEmailCheckRegex"
style="width: 80%;" :placeholder="t('emailCheckRegex')" />
</n-input-group>
</n-form-item-row>
</n-form>
</n-card>
</div>