refactor: fix password auth

refactor: move tabs around
This commit is contained in:
Andy Burke 2025-07-23 13:01:52 -07:00
parent 316663be32
commit e397bc884b
17 changed files with 49 additions and 26 deletions

View file

@ -79,7 +79,7 @@ export async function POST(req: Request, meta: Record<string, any>): Promise<Res
});
}
const verified = await bcrypt.compare(`${password_hash}${password_entry.salt}`, password_entry.hash);
const verified = await bcrypt.compare(password_hash, password_entry.hash);
if (!verified) {
return Response.json({

View file

@ -106,13 +106,12 @@ export async function POST(req: Request, meta: Record<string, any>): Promise<Res
await USERS.create(user);
const salt = await bcrypt.genSalt();
const hashed_password_value = await bcrypt.hash(password_hash, salt);
// automatically salted
const hashed_password_value = await bcrypt.hash(password_hash);
const password_entry: PASSWORD_ENTRY = {
user_id: user.id,
hash: hashed_password_value,
salt,
timestamps: {
created: now,
updated: now