Add user first and last name fields to signup form

This commit is contained in:
Sean Morley
2024-04-03 22:59:05 +00:00
parent 372db59211
commit ba6a5283fe
12 changed files with 273 additions and 10 deletions

View File

@@ -0,0 +1,30 @@
import { lucia } from "$lib/server/auth";
import { fail, redirect } from "@sveltejs/kit";
import type { Actions, PageServerLoad } from "./$types";
export const load: PageServerLoad = async (event) => {
if (event.locals.user)
return {
user: event.locals.user,
};
return {
user: null,
};
};
export const actions: Actions = {
default: async (event) => {
if (!event.locals.session) {
return fail(401);
}
await lucia.invalidateSession(event.locals.session.id);
const sessionCookie = lucia.createBlankSessionCookie();
event.cookies.set(sessionCookie.name, sessionCookie.value, {
path: ".",
...sessionCookie.attributes,
});
return redirect(302, "/login");
},
};