Skip to content

Commit 31dd824

Browse files
committed
feat: enable oauth
1 parent 4fc4762 commit 31dd824

File tree

4 files changed

+32
-17
lines changed

4 files changed

+32
-17
lines changed

apps/frontend/src/lib/components/blocks/space/space-dropdown.svelte

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
import { goto, invalidateAll } from "$app/navigation"
1818
import { Skeleton } from "$lib/components/ui/skeleton"
1919
import { toast } from "svelte-sonner"
20+
import { env } from "$env/dynamic/public"
2021
2122
export let space: ISpaceDTO
2223
export let me: any

apps/frontend/src/routes/(auth)/login/+page.svelte

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
import { LoaderCircleIcon } from "lucide-svelte"
2020
import ResetPassword from "$lib/components/blocks/auth/reset-password.svelte"
2121
import { page } from "$app/stores"
22+
import { env } from "$env/dynamic/public"
2223
2324
const schema = z.object({
2425
email: z.string().email(),
@@ -215,14 +216,18 @@
215216
</div>
216217
<Separator class="my-6" />
217218
<div class="space-y-2">
218-
<Button href="/login/github" variant="secondary" class="w-full">
219-
<img class="mr-2 h-4 w-4" src={Github} alt="github" />
220-
Login with Github
221-
</Button>
222-
<Button href="/login/google" variant="secondary" class="w-full">
223-
<img class="mr-2 h-4 w-4" src={Google} alt="google" />
224-
Login with Google
225-
</Button>
219+
{#if env.UNDB_PUBLIC_OAUTH_GITHUB_ENABLED === "true"}
220+
<Button href="/login/github" variant="secondary" class="w-full">
221+
<img class="mr-2 h-4 w-4" src={Github} alt="github" />
222+
Login with Github
223+
</Button>
224+
{/if}
225+
{#if env.UNDB_PUBLIC_OAUTH_GOOGLE_ENABLED === "true"}
226+
<Button href="/login/google" variant="secondary" class="w-full">
227+
<img class="mr-2 h-4 w-4" src={Google} alt="google" />
228+
Login with Google
229+
</Button>
230+
{/if}
226231
</div>
227232
</Card.Content>
228233
</Card.Root>

apps/frontend/src/routes/(auth)/signup/+page.svelte

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
import { Separator } from "$lib/components/ui/separator"
1818
import PasswordInput from "$lib/components/ui/input/password-input.svelte"
1919
import { LoaderCircleIcon } from "lucide-svelte"
20+
import { env } from "$env/dynamic/public"
2021
2122
const schema = z.object({
2223
email: z.string().email(),
@@ -245,20 +246,25 @@
245246
<a href={`/login?invitationId=${invitationId}`} class="underline"> Sign in </a>
246247
{:else if redirect}
247248
<a href={`/login?redirect=${redirect}`} class="underline"> Sign in </a>
248-
{:else} <a href="/login" class="underline"> Sign in </a>
249+
{:else}
250+
<a href="/login" class="underline"> Sign in </a>
249251
{/if}
250252
</div>
251253
{#if !invitationId}
252254
<Separator class="my-6" />
253255
<div class="space-y-2">
254-
<Button href="/login/github" variant="secondary" class="w-full">
255-
<img class="mr-2 h-4 w-4" src={Github} alt="github" />
256-
Login with Github
257-
</Button>
258-
<Button href="/login/google" variant="secondary" class="w-full">
259-
<img class="mr-2 h-4 w-4" src={Google} alt="google" />
260-
Login with Google
261-
</Button>
256+
{#if env.UNDB_PUBLIC_OAUTH_GITHUB_ENABLED === "true"}
257+
<Button href="/login/github" variant="secondary" class="w-full">
258+
<img class="mr-2 h-4 w-4" src={Github} alt="github" />
259+
Login with Github
260+
</Button>
261+
{/if}
262+
{#if env.UNDB_PUBLIC_OAUTH_GOOGLE_ENABLED === "true"}
263+
<Button href="/login/google" variant="secondary" class="w-full">
264+
<img class="mr-2 h-4 w-4" src={Google} alt="google" />
265+
Login with Google
266+
</Button>
267+
{/if}
262268
</div>
263269
{/if}
264270
</Card.Content>

apps/frontend/svelte.config.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ const config = {
1212
pages: "dist",
1313
fallback: "index.html",
1414
}),
15+
env: {
16+
publicPrefix: "UNDB_PUBLIC_",
17+
},
1518
alias: {
1619
$houdini: "./$houdini",
1720
},

0 commit comments

Comments
 (0)