feat(auth): disable registration form when signup is disabled (#83)

This commit is contained in:
Corentin THOMASSET
2025-01-17 23:56:47 +01:00
committed by GitHub
parent 904f2c091a
commit 82ecba25e0

View File

@@ -99,6 +99,34 @@ export const EmailRegisterForm: Component = () => {
};
export const RegisterPage: Component = () => {
const { config } = useConfig();
if (!config.auth.isRegistrationEnabled) {
return (
<AuthLayout>
<div class="flex items-center justify-center min-h-screen p-6 pb-18">
<div class="max-w-sm w-full">
<h1 class="text-xl font-bold">
Registration is disabled
</h1>
<p class="text-muted-foreground mt-1 mb-4">
The creation of new accounts is currently disabled on this instance of Papra. Only users with existing accounts can log in. If you think this is a mistake, please contact the administrator of this instance.
</p>
<p class="text-muted-foreground mt-4">
Already have an account?
{' '}
<Button variant="link" as={A} class="inline px-0" href="/login">
Login
</Button>
</p>
</div>
</div>
</AuthLayout>
);
}
const [getShowEmailRegister, setShowEmailRegister] = createSignal(false);
const loginWithProvider = async (provider: typeof ssoProviders[number]) => {