Skip to content

Commit

Permalink
Show login button even if registration is disabled
Browse files Browse the repository at this point in the history
  • Loading branch information
Yureien committed Mar 29, 2024
1 parent 517cddb commit c0afcbc
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 26 deletions.
17 changes: 10 additions & 7 deletions src/routes/(auth)/login/+page.svelte
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<script lang="ts">
import { enhance } from '$app/forms';
import { env } from '$env/dynamic/public';
import type { ActionData } from './$types';
export let form: ActionData;
Expand Down Expand Up @@ -43,13 +44,15 @@
/>
</div>

<div class="flex flex-row items-center gap-4 mt-2">
<span class="px-2 py-1">
Don't have an account? <a
class="underline underline-offset-4"
href="/register">Register</a
>.
</span>
<div class="flex flex-row items-center justify-center gap-4 mt-2">
{#if env.PUBLIC_REGISTRATION_ENABLED == 'true'}
<span class="px-2 py-1">
Don't have an account? <a
class="underline underline-offset-4"
href="/register">Register</a
>.
</span>
{/if}

<button class="bg-amber-500 text-black text-lg px-4 py-1"
>Login</button
Expand Down
36 changes: 17 additions & 19 deletions src/routes/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -242,31 +242,29 @@
</button>
</div>

{#if env.PUBLIC_REGISTRATION_ENABLED == 'true'}
<div class="flex flex-row gap-4 mb-4 justify-center">
{#if data.loggedIn}
<a
href="/dashboard/settings"
class="underline underline-offset-4 py-1"
>Dashboard</a
>
<form action="/logout" method="post">
<button class="underline underline-offset-4 py-1"
>Logout</button
>
</form>
{:else}
<a
class="underline underline-offset-4 py-1"
href="/login">Login</a
<div class="flex flex-row gap-4 mb-4 justify-center">
{#if data.loggedIn}
<a
href="/dashboard/settings"
class="underline underline-offset-4 py-1">Dashboard</a
>
<form action="/logout" method="post">
<button class="underline underline-offset-4 py-1"
>Logout</button
>
</form>
{:else}
<a class="underline underline-offset-4 py-1" href="/login"
>Login</a
>
{#if env.PUBLIC_REGISTRATION_ENABLED == 'true'}
<a
class="underline underline-offset-4 py-1"
href="/register">Register</a
>
{/if}
</div>
{/if}
{/if}
</div>

<Select
class="px-1 py-1"
Expand Down

0 comments on commit c0afcbc

Please sign in to comment.