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

@@ -1,9 +1,8 @@
import { DrizzlePostgreSQLAdapter } from "@lucia-auth/adapter-drizzle";
import { Lucia } from "lucia";
import { Lucia, TimeSpan } from "lucia";
import { dev } from "$app/environment";
import { userTable, sessionTable } from "$lib/db/schema";
import { db } from "$lib/db/db.server";
import { Argon2id } from "oslo/password";
const adapter = new DrizzlePostgreSQLAdapter(db, sessionTable, userTable);
@@ -17,6 +16,9 @@ export const lucia = new Lucia(adapter, {
return {
// attributes has the type of DatabaseUserAttributes
username: attributes.username,
id: attributes.id,
first_name: attributes.first_name,
last_name: attributes.last_name,
};
},
});
@@ -24,15 +26,14 @@ export const lucia = new Lucia(adapter, {
declare module "lucia" {
interface Register {
Lucia: typeof lucia;
DatabaseUserAttributes: DatabaseUserAttributes;
DatabaseUserAttributes: DatabaseUser;
}
}
interface DatabaseUserAttributes {
username: string;
}
export interface DatabaseUser {
id: string;
username: string;
first_name: string;
last_name: string;
hashed_password: string;
}