mirror of
https://github.com/Memo-2023/mana-monorepo.git
synced 2026-05-14 20:21:09 +02:00
fix(auth): move email verification config to correct location
Better Auth requires emailVerification config to be a separate top-level option, not under emailAndPassword. Added sendOnSignUp: true to trigger verification emails on registration. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
aa7f5fbb25
commit
14aaf01fa3
1 changed files with 21 additions and 17 deletions
|
|
@ -85,29 +85,13 @@ export function createBetterAuth(databaseUrl: string) {
|
|||
},
|
||||
}),
|
||||
|
||||
// Email/password authentication with email verification and password reset
|
||||
// Email/password authentication with password reset
|
||||
emailAndPassword: {
|
||||
enabled: true,
|
||||
requireEmailVerification: true,
|
||||
minPasswordLength: 8,
|
||||
maxPasswordLength: 128,
|
||||
|
||||
/**
|
||||
* Email Verification
|
||||
*
|
||||
* Sends verification email when user registers.
|
||||
* User must verify email before they can log in.
|
||||
*/
|
||||
sendVerificationEmail: async ({
|
||||
user,
|
||||
url,
|
||||
}: {
|
||||
user: { email: string; name: string };
|
||||
url: string;
|
||||
}) => {
|
||||
await sendVerificationEmail(user.email, url, user.name);
|
||||
},
|
||||
|
||||
/**
|
||||
* Password Reset Configuration
|
||||
*
|
||||
|
|
@ -128,6 +112,26 @@ export function createBetterAuth(databaseUrl: string) {
|
|||
},
|
||||
},
|
||||
|
||||
/**
|
||||
* Email Verification Configuration
|
||||
*
|
||||
* Sends verification email when user registers.
|
||||
* User must verify email before they can log in.
|
||||
*/
|
||||
emailVerification: {
|
||||
sendOnSignUp: true,
|
||||
autoSignInAfterVerification: true,
|
||||
sendVerificationEmail: async ({
|
||||
user,
|
||||
url,
|
||||
}: {
|
||||
user: { email: string; name: string };
|
||||
url: string;
|
||||
}) => {
|
||||
await sendVerificationEmail(user.email, url, user.name);
|
||||
},
|
||||
},
|
||||
|
||||
// Session configuration
|
||||
session: {
|
||||
expiresIn: 60 * 60 * 24 * 7, // 7 days
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue