Lucia Authentication #8

Merged
DanMihailescu merged 18 commits from undoPretty into master 2024-12-19 20:06:45 -05:00
3 changed files with 55 additions and 6 deletions
Showing only changes of commit 87921c24a0 - Show all commits

Binary file not shown.

View file

@ -1,15 +1,15 @@
BenjaminPalko commented 2024-12-17 14:14:38 -05:00 (Migrated from github.com)
Review

I dont think you can type event as a a Session, from the app typedefs you made it should be event.locals.[session or user idk]

I dont think you can type event as a a Session, from the app typedefs you made it should be _event.locals.[session or user idk]_
BenjaminPalko commented 2024-12-17 14:14:57 -05:00 (Migrated from github.com)
Review
https://github.com/Machinata/hestia/pull/8/files#diff-b07092d78bfaa239d6ad0d01b0897c3ef49533b08512622d83c6f4e1dd3b363e
DanMihailescu commented 2024-12-18 10:07:50 -05:00 (Migrated from github.com)
Review

switched back to any type

switched back to any type
BenjaminPalko commented 2024-12-18 12:34:07 -05:00 (Migrated from github.com)
Review

Use the logger pls

Use the logger pls
BenjaminPalko commented 2024-12-17 14:14:38 -05:00 (Migrated from github.com)
Review

I dont think you can type event as a a Session, from the app typedefs you made it should be event.locals.[session or user idk]

I dont think you can type event as a a Session, from the app typedefs you made it should be _event.locals.[session or user idk]_
BenjaminPalko commented 2024-12-17 14:14:57 -05:00 (Migrated from github.com)
Review
https://github.com/Machinata/hestia/pull/8/files#diff-b07092d78bfaa239d6ad0d01b0897c3ef49533b08512622d83c6f4e1dd3b363e
DanMihailescu commented 2024-12-18 10:07:50 -05:00 (Migrated from github.com)
Review

switched back to any type

switched back to any type
BenjaminPalko commented 2024-12-18 12:34:07 -05:00 (Migrated from github.com)
Review

Use the logger pls

Use the logger pls
import { prisma } from '$lib/server/prisma';
BenjaminPalko commented 2024-12-17 14:14:38 -05:00 (Migrated from github.com)
Review

I dont think you can type event as a a Session, from the app typedefs you made it should be event.locals.[session or user idk]

I dont think you can type event as a a Session, from the app typedefs you made it should be _event.locals.[session or user idk]_
BenjaminPalko commented 2024-12-17 14:14:57 -05:00 (Migrated from github.com)
Review
https://github.com/Machinata/hestia/pull/8/files#diff-b07092d78bfaa239d6ad0d01b0897c3ef49533b08512622d83c6f4e1dd3b363e
DanMihailescu commented 2024-12-18 10:07:50 -05:00 (Migrated from github.com)
Review

switched back to any type

switched back to any type
BenjaminPalko commented 2024-12-18 12:34:07 -05:00 (Migrated from github.com)
Review

Use the logger pls

Use the logger pls
export async function load(event) {
BenjaminPalko commented 2024-12-17 14:14:38 -05:00 (Migrated from github.com)
Review

I dont think you can type event as a a Session, from the app typedefs you made it should be event.locals.[session or user idk]

I dont think you can type event as a a Session, from the app typedefs you made it should be _event.locals.[session or user idk]_
BenjaminPalko commented 2024-12-17 14:14:57 -05:00 (Migrated from github.com)
Review
https://github.com/Machinata/hestia/pull/8/files#diff-b07092d78bfaa239d6ad0d01b0897c3ef49533b08512622d83c6f4e1dd3b363e
DanMihailescu commented 2024-12-18 10:07:50 -05:00 (Migrated from github.com)
Review

switched back to any type

switched back to any type
BenjaminPalko commented 2024-12-18 12:34:07 -05:00 (Migrated from github.com)
Review

Use the logger pls

Use the logger pls
const userId = event.cookies.get('user');
BenjaminPalko commented 2024-12-17 14:14:38 -05:00 (Migrated from github.com)
Review

I dont think you can type event as a a Session, from the app typedefs you made it should be event.locals.[session or user idk]

I dont think you can type event as a a Session, from the app typedefs you made it should be _event.locals.[session or user idk]_
BenjaminPalko commented 2024-12-17 14:14:57 -05:00 (Migrated from github.com)
Review
https://github.com/Machinata/hestia/pull/8/files#diff-b07092d78bfaa239d6ad0d01b0897c3ef49533b08512622d83c6f4e1dd3b363e
DanMihailescu commented 2024-12-18 10:07:50 -05:00 (Migrated from github.com)
Review

switched back to any type

switched back to any type
BenjaminPalko commented 2024-12-18 12:34:07 -05:00 (Migrated from github.com)
Review

Use the logger pls

Use the logger pls
if (!userId && isNaN(Number(userId))) {
BenjaminPalko commented 2024-12-17 14:14:38 -05:00 (Migrated from github.com)
Review

I dont think you can type event as a a Session, from the app typedefs you made it should be event.locals.[session or user idk]

I dont think you can type event as a a Session, from the app typedefs you made it should be _event.locals.[session or user idk]_
BenjaminPalko commented 2024-12-17 14:14:57 -05:00 (Migrated from github.com)
Review
https://github.com/Machinata/hestia/pull/8/files#diff-b07092d78bfaa239d6ad0d01b0897c3ef49533b08512622d83c6f4e1dd3b363e
DanMihailescu commented 2024-12-18 10:07:50 -05:00 (Migrated from github.com)
Review

switched back to any type

switched back to any type
BenjaminPalko commented 2024-12-18 12:34:07 -05:00 (Migrated from github.com)
Review

Use the logger pls

Use the logger pls
import type { Session } from 'lucia';
BenjaminPalko commented 2024-12-17 14:14:38 -05:00 (Migrated from github.com)
Review

I dont think you can type event as a a Session, from the app typedefs you made it should be event.locals.[session or user idk]

I dont think you can type event as a a Session, from the app typedefs you made it should be _event.locals.[session or user idk]_
BenjaminPalko commented 2024-12-17 14:14:57 -05:00 (Migrated from github.com)
Review
https://github.com/Machinata/hestia/pull/8/files#diff-b07092d78bfaa239d6ad0d01b0897c3ef49533b08512622d83c6f4e1dd3b363e
DanMihailescu commented 2024-12-18 10:07:50 -05:00 (Migrated from github.com)
Review

switched back to any type

switched back to any type
BenjaminPalko commented 2024-12-18 12:34:07 -05:00 (Migrated from github.com)
Review

Use the logger pls

Use the logger pls
export async function load(event: Session) {
BenjaminPalko commented 2024-12-17 14:14:38 -05:00 (Migrated from github.com)
Review

I dont think you can type event as a a Session, from the app typedefs you made it should be event.locals.[session or user idk]

I dont think you can type event as a a Session, from the app typedefs you made it should be _event.locals.[session or user idk]_
BenjaminPalko commented 2024-12-17 14:14:57 -05:00 (Migrated from github.com)
Review
https://github.com/Machinata/hestia/pull/8/files#diff-b07092d78bfaa239d6ad0d01b0897c3ef49533b08512622d83c6f4e1dd3b363e
DanMihailescu commented 2024-12-18 10:07:50 -05:00 (Migrated from github.com)
Review

switched back to any type

switched back to any type
BenjaminPalko commented 2024-12-18 12:34:07 -05:00 (Migrated from github.com)
Review

Use the logger pls

Use the logger pls
const userId = event.userId;
BenjaminPalko commented 2024-12-17 14:14:38 -05:00 (Migrated from github.com)
Review

I dont think you can type event as a a Session, from the app typedefs you made it should be event.locals.[session or user idk]

I dont think you can type event as a a Session, from the app typedefs you made it should be _event.locals.[session or user idk]_
BenjaminPalko commented 2024-12-17 14:14:57 -05:00 (Migrated from github.com)
Review
https://github.com/Machinata/hestia/pull/8/files#diff-b07092d78bfaa239d6ad0d01b0897c3ef49533b08512622d83c6f4e1dd3b363e
DanMihailescu commented 2024-12-18 10:07:50 -05:00 (Migrated from github.com)
Review

switched back to any type

switched back to any type
BenjaminPalko commented 2024-12-18 12:34:07 -05:00 (Migrated from github.com)
Review

Use the logger pls

Use the logger pls
if (!userId) {
BenjaminPalko commented 2024-12-17 14:14:38 -05:00 (Migrated from github.com)
Review

I dont think you can type event as a a Session, from the app typedefs you made it should be event.locals.[session or user idk]

I dont think you can type event as a a Session, from the app typedefs you made it should be _event.locals.[session or user idk]_
BenjaminPalko commented 2024-12-17 14:14:57 -05:00 (Migrated from github.com)
Review
https://github.com/Machinata/hestia/pull/8/files#diff-b07092d78bfaa239d6ad0d01b0897c3ef49533b08512622d83c6f4e1dd3b363e
DanMihailescu commented 2024-12-18 10:07:50 -05:00 (Migrated from github.com)
Review

switched back to any type

switched back to any type
BenjaminPalko commented 2024-12-18 12:34:07 -05:00 (Migrated from github.com)
Review

Use the logger pls

Use the logger pls
return {
authenticated: false
};
}
const user = await prisma.user.findUnique({
where: {
id: Number(userId)
BenjaminPalko commented 2024-12-17 14:14:38 -05:00 (Migrated from github.com)
Review

I dont think you can type event as a a Session, from the app typedefs you made it should be event.locals.[session or user idk]

I dont think you can type event as a a Session, from the app typedefs you made it should be _event.locals.[session or user idk]_
BenjaminPalko commented 2024-12-17 14:14:57 -05:00 (Migrated from github.com)
Review
https://github.com/Machinata/hestia/pull/8/files#diff-b07092d78bfaa239d6ad0d01b0897c3ef49533b08512622d83c6f4e1dd3b363e
DanMihailescu commented 2024-12-18 10:07:50 -05:00 (Migrated from github.com)
Review

switched back to any type

switched back to any type
BenjaminPalko commented 2024-12-18 12:34:07 -05:00 (Migrated from github.com)
Review

Use the logger pls

Use the logger pls
id: userId
BenjaminPalko commented 2024-12-17 14:14:38 -05:00 (Migrated from github.com)
Review

I dont think you can type event as a a Session, from the app typedefs you made it should be event.locals.[session or user idk]

I dont think you can type event as a a Session, from the app typedefs you made it should be _event.locals.[session or user idk]_
BenjaminPalko commented 2024-12-17 14:14:57 -05:00 (Migrated from github.com)
Review
https://github.com/Machinata/hestia/pull/8/files#diff-b07092d78bfaa239d6ad0d01b0897c3ef49533b08512622d83c6f4e1dd3b363e
DanMihailescu commented 2024-12-18 10:07:50 -05:00 (Migrated from github.com)
Review

switched back to any type

switched back to any type
BenjaminPalko commented 2024-12-18 12:34:07 -05:00 (Migrated from github.com)
Review

Use the logger pls

Use the logger pls
}
});
return {

BenjaminPalko commented 2024-12-17 14:14:38 -05:00 (Migrated from github.com)
Review

I dont think you can type event as a a Session, from the app typedefs you made it should be event.locals.[session or user idk]

I dont think you can type event as a a Session, from the app typedefs you made it should be _event.locals.[session or user idk]_
BenjaminPalko commented 2024-12-17 14:14:57 -05:00 (Migrated from github.com)
Review
https://github.com/Machinata/hestia/pull/8/files#diff-b07092d78bfaa239d6ad0d01b0897c3ef49533b08512622d83c6f4e1dd3b363e
DanMihailescu commented 2024-12-18 10:07:50 -05:00 (Migrated from github.com)
Review

switched back to any type

switched back to any type
BenjaminPalko commented 2024-12-18 12:34:07 -05:00 (Migrated from github.com)
Review

Use the logger pls

Use the logger pls
BenjaminPalko commented 2024-12-17 14:14:38 -05:00 (Migrated from github.com)
Review

I dont think you can type event as a a Session, from the app typedefs you made it should be event.locals.[session or user idk]

I dont think you can type event as a a Session, from the app typedefs you made it should be _event.locals.[session or user idk]_
BenjaminPalko commented 2024-12-17 14:14:57 -05:00 (Migrated from github.com)
Review
https://github.com/Machinata/hestia/pull/8/files#diff-b07092d78bfaa239d6ad0d01b0897c3ef49533b08512622d83c6f4e1dd3b363e
DanMihailescu commented 2024-12-18 10:07:50 -05:00 (Migrated from github.com)
Review

switched back to any type

switched back to any type
BenjaminPalko commented 2024-12-18 12:34:07 -05:00 (Migrated from github.com)
Review

Use the logger pls

Use the logger pls

View file

@ -0,0 +1,49 @@
<script lang="ts">
import Button from '$lib/components/Button.svelte';
import Input from '$lib/components/Input.svelte';
import { fade, scale } from 'svelte/transition';
let mode: 'register' | 'login' = $state('login');
let action = $derived(mode === 'login' ? '?/login' : '?/register');
function onViewToggle() {
mode = mode === 'login' ? 'register' : 'login';
}
</script>
<div class="page">
<h1 class="underline">Hestia</h1>
<div class="login">
<form method="POST" {action} transition:scale>
<h2 transition:fade>{mode === 'login' ? 'Login' : 'Register'}</h2>
{#if mode === 'register'}
<div transition:fade>
<Input label="Name" name="name" />
</div>
{/if}
<Input label="Email" name="email" type="email" />
<Input label="Password" name="password" type="password" />
<div class="flex gap-2">
<Button
onClick={onViewToggle}
label={mode === 'login' ? 'Register' : 'Login'}
size="large"
primary
/>
<Button type="submit" label="Submit" size="large" />
</div>
</form>
</div>
</div>
<style>
.page {
@apply flex flex-col items-center justify-around gap-24 py-[10%];
}
.login {
@apply w-fit max-w-lg animate-fade rounded-lg bg-white p-8;
}
.login > form {
@apply flex w-full flex-col items-center gap-8 rounded-lg;
}
</style>