Email + password login scheme set up, mailgun sending set up.

This commit is contained in:
2026-04-02 14:29:56 -05:00
parent d3021014ed
commit f13035f8c5
10 changed files with 241 additions and 41 deletions

View File

@@ -1,4 +1,5 @@
import { betterAuth } from 'better-auth';
import { hash as argon2Hash, verify as argon2Verify } from '@node-rs/argon2';
import { kyselyAdapter } from '@better-auth/kysely-adapter';
import { Kysely, PostgresDialect } from 'kysely';
import { Pool } from 'pg';
@@ -29,6 +30,10 @@ export const auth = betterAuth({
emailAndPassword: {
enabled: true,
requireEmailVerification: true,
password: {
hash: (password) => argon2Hash(password, { memoryCost: 65536, timeCost: 3, parallelism: 4, algorithm: 2 }),
verify: ({ hash, password }) => argon2Verify(hash, password),
},
sendResetPassword: async ({ user, url }) => {
await sendEmail({
to: user.email,