add: クライアント側に実装
This commit is contained in:
parent
f4972bb1ae
commit
a282fdb397
5 changed files with 35 additions and 2 deletions
|
|
@ -254,10 +254,25 @@ async function onSubmit(): Promise<void> {
|
|||
'turnstile-response': turnstileResponse,
|
||||
});
|
||||
if (instance.emailRequiredForSignup) {
|
||||
const text = [i18n.t('_signup.emailSent', { email })];
|
||||
|
||||
if (instance.emailVerificationExpiresIn) {
|
||||
let time = '';
|
||||
const hours = Math.floor(instance.emailVerificationExpiresIn / 60);
|
||||
const minutes = instance.emailVerificationExpiresIn % 60;
|
||||
if (hours > 0) {
|
||||
time += hours + i18n.t('_time.hour');
|
||||
}
|
||||
if (minutes > 0) {
|
||||
time += minutes + i18n.t('_time.minute');
|
||||
}
|
||||
text.push(i18n.t('_signup.expiresTime', { time }));
|
||||
}
|
||||
|
||||
os.alert({
|
||||
type: 'success',
|
||||
title: i18n.ts._signup.almostThere,
|
||||
text: i18n.t('_signup.emailSent', { email }),
|
||||
text: text.join('\n'),
|
||||
});
|
||||
emit('signupEmailPending');
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -18,6 +18,12 @@ SPDX-License-Identifier: AGPL-3.0-only
|
|||
<template #label>{{ i18n.ts.emailRequiredForSignup }}</template>
|
||||
</MkSwitch>
|
||||
|
||||
<MkInput v-if="emailRequiredForSignup" v-model="emailVerificationExpiresIn" type="number" :min="0">
|
||||
<template #label>{{ i18n.ts.emailVerificationExpiresIn }}</template>
|
||||
<template #suffix>{{ i18n.ts._time.minute }}</template>
|
||||
<template #caption>{{ i18n.ts.emailVerificationExpiresInDescription }}</template>
|
||||
</MkInput>
|
||||
|
||||
<FormLink to="/admin/server-rules">{{ i18n.ts.serverRules }}</FormLink>
|
||||
|
||||
<MkInput v-model="tosUrl" type="url">
|
||||
|
|
@ -71,6 +77,7 @@ import FormLink from '@/components/form/link.vue';
|
|||
|
||||
let enableRegistration: boolean = $ref(false);
|
||||
let emailRequiredForSignup: boolean = $ref(false);
|
||||
let emailVerificationExpiresIn: number = $ref(0);
|
||||
let sensitiveWords: string = $ref('');
|
||||
let preservedUsernames: string = $ref('');
|
||||
let tosUrl: string | null = $ref(null);
|
||||
|
|
@ -80,6 +87,7 @@ async function init() {
|
|||
const meta = await os.api('admin/meta');
|
||||
enableRegistration = !meta.disableRegistration;
|
||||
emailRequiredForSignup = meta.emailRequiredForSignup;
|
||||
emailVerificationExpiresIn = meta.emailVerificationExpiresIn;
|
||||
sensitiveWords = meta.sensitiveWords.join('\n');
|
||||
preservedUsernames = meta.preservedUsernames.join('\n');
|
||||
tosUrl = meta.tosUrl;
|
||||
|
|
@ -90,6 +98,7 @@ function save() {
|
|||
os.apiWithDialog('admin/update-meta', {
|
||||
disableRegistration: !enableRegistration,
|
||||
emailRequiredForSignup,
|
||||
emailVerificationExpiresIn,
|
||||
tosUrl,
|
||||
privacyPolicyUrl,
|
||||
sensitiveWords: sensitiveWords.split('\n'),
|
||||
|
|
|
|||
|
|
@ -51,7 +51,8 @@ function submit() {
|
|||
|
||||
os.alert({
|
||||
type: 'error',
|
||||
text: i18n.ts.somethingHappened,
|
||||
title: i18n.ts.somethingHappened,
|
||||
text: i18n.ts.signupPendingError,
|
||||
});
|
||||
});
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue