feat: basic admin interface
This commit is contained in:
@@ -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