feat: basic admin interface
This commit is contained in:
@@ -14,7 +14,8 @@ if (session.value !== null) {
|
||||
await navigateTo(to ?? '/');
|
||||
}
|
||||
|
||||
const config = useRuntimeConfig();
|
||||
// who may register is an instance setting, admins change it while it runs
|
||||
const { data: instance } = await useFetch('/api/instance', { key: 'instance' });
|
||||
|
||||
const form = reactive({
|
||||
email: '',
|
||||
@@ -110,6 +111,10 @@ const submit = async () => {
|
||||
emailInputEl.value!.setCustomValidity(res.error.data.message!);
|
||||
emailInputEl.value!.reportValidity();
|
||||
break;
|
||||
case 'BANNED_USER':
|
||||
emailInputEl.value!.setCustomValidity('This account has been disabled by an admin of this instance.');
|
||||
emailInputEl.value!.reportValidity();
|
||||
break;
|
||||
default:
|
||||
console.log(res.error);
|
||||
alert(`Something went wrong. ${res.error.data.message}`);
|
||||
@@ -303,7 +308,7 @@ const submitTwoFactor = async () => {
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<p v-if="!config.public.disableSignup && step === 'credentials'" class="text-sm text-center mt-3 text-[var(--text-secondary)]">
|
||||
<p v-if="instance?.registration === 'open' && step === 'credentials'" class="text-sm text-center mt-3 text-[var(--text-secondary)]">
|
||||
New to Veridian?
|
||||
<NuxtLink :to="to ? `/auth/register?to=${to}` : '/auth/register'"
|
||||
class="text-[var(--color-accent)] font-medium @hover:underline">
|
||||
|
||||
@@ -12,9 +12,10 @@ if (session.value !== null) {
|
||||
await navigateTo(to ?? '/');
|
||||
}
|
||||
|
||||
const config = useRuntimeConfig();
|
||||
// who may register is an instance setting, admins change it while it runs
|
||||
const { data: instance } = await useFetch('/api/instance', { key: 'instance' });
|
||||
|
||||
if (config.public.disableSignup) {
|
||||
if (instance.value && instance.value.registration !== 'open') {
|
||||
await navigateTo(to ? `/auth/login?to=${to}` : '/auth/login');
|
||||
}
|
||||
|
||||
@@ -121,6 +122,10 @@ const submit = async () => {
|
||||
passwordInputEl.value!.setCustomValidity(res.error.data.message!);
|
||||
passwordInputEl.value!.reportValidity();
|
||||
break;
|
||||
case 'REGISTRATION_CLOSED':
|
||||
// an admin closed registration while this page was open
|
||||
alert('Registration is closed on this instance. Ask an admin for an account.');
|
||||
break;
|
||||
default:
|
||||
console.log(res.error);
|
||||
alert('Something went wrong: ' + res.error.data.message);
|
||||
|
||||
Reference in New Issue
Block a user