Add user first and last name fields to signup form
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user