Skip to content

Commit

Permalink
feat: enable oauth
Browse files Browse the repository at this point in the history
  • Loading branch information
nichenqin committed Aug 27, 2024
1 parent 4fc4762 commit 31dd824
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import { goto, invalidateAll } from "$app/navigation"
import { Skeleton } from "$lib/components/ui/skeleton"
import { toast } from "svelte-sonner"
import { env } from "$env/dynamic/public"
export let space: ISpaceDTO
export let me: any
Expand Down
21 changes: 13 additions & 8 deletions apps/frontend/src/routes/(auth)/login/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import { LoaderCircleIcon } from "lucide-svelte"
import ResetPassword from "$lib/components/blocks/auth/reset-password.svelte"
import { page } from "$app/stores"
import { env } from "$env/dynamic/public"
const schema = z.object({
email: z.string().email(),
Expand Down Expand Up @@ -215,14 +216,18 @@
</div>
<Separator class="my-6" />
<div class="space-y-2">
<Button href="/login/github" variant="secondary" class="w-full">
<img class="mr-2 h-4 w-4" src={Github} alt="github" />
Login with Github
</Button>
<Button href="/login/google" variant="secondary" class="w-full">
<img class="mr-2 h-4 w-4" src={Google} alt="google" />
Login with Google
</Button>
{#if env.UNDB_PUBLIC_OAUTH_GITHUB_ENABLED === "true"}
<Button href="/login/github" variant="secondary" class="w-full">
<img class="mr-2 h-4 w-4" src={Github} alt="github" />
Login with Github
</Button>
{/if}
{#if env.UNDB_PUBLIC_OAUTH_GOOGLE_ENABLED === "true"}
<Button href="/login/google" variant="secondary" class="w-full">
<img class="mr-2 h-4 w-4" src={Google} alt="google" />
Login with Google
</Button>
{/if}
</div>
</Card.Content>
</Card.Root>
Expand Down
24 changes: 15 additions & 9 deletions apps/frontend/src/routes/(auth)/signup/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import { Separator } from "$lib/components/ui/separator"
import PasswordInput from "$lib/components/ui/input/password-input.svelte"
import { LoaderCircleIcon } from "lucide-svelte"
import { env } from "$env/dynamic/public"
const schema = z.object({
email: z.string().email(),
Expand Down Expand Up @@ -245,20 +246,25 @@
<a href={`/login?invitationId=${invitationId}`} class="underline"> Sign in </a>
{:else if redirect}
<a href={`/login?redirect=${redirect}`} class="underline"> Sign in </a>
{:else} <a href="/login" class="underline"> Sign in </a>
{:else}
<a href="/login" class="underline"> Sign in </a>
{/if}
</div>
{#if !invitationId}
<Separator class="my-6" />
<div class="space-y-2">
<Button href="/login/github" variant="secondary" class="w-full">
<img class="mr-2 h-4 w-4" src={Github} alt="github" />
Login with Github
</Button>
<Button href="/login/google" variant="secondary" class="w-full">
<img class="mr-2 h-4 w-4" src={Google} alt="google" />
Login with Google
</Button>
{#if env.UNDB_PUBLIC_OAUTH_GITHUB_ENABLED === "true"}
<Button href="/login/github" variant="secondary" class="w-full">
<img class="mr-2 h-4 w-4" src={Github} alt="github" />
Login with Github
</Button>
{/if}
{#if env.UNDB_PUBLIC_OAUTH_GOOGLE_ENABLED === "true"}
<Button href="/login/google" variant="secondary" class="w-full">
<img class="mr-2 h-4 w-4" src={Google} alt="google" />
Login with Google
</Button>
{/if}
</div>
{/if}
</Card.Content>
Expand Down
3 changes: 3 additions & 0 deletions apps/frontend/svelte.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ const config = {
pages: "dist",
fallback: "index.html",
}),
env: {
publicPrefix: "UNDB_PUBLIC_",
},
alias: {
$houdini: "./$houdini",
},
Expand Down

0 comments on commit 31dd824

Please sign in to comment.