Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions dev_env/seed_db.sql
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ VALUES
ON CONFLICT (id) DO UPDATE SET
dj_name = EXCLUDED.dj_name,
real_name = EXCLUDED.real_name,
email_verified = EXCLUDED.email_verified,
role = EXCLUDED.role,
updated_at = NOW();

-- Create credential accounts for all test users
Expand Down
19 changes: 6 additions & 13 deletions shared/authentication/src/auth.definition.ts
Original file line number Diff line number Diff line change
Expand Up @@ -273,19 +273,12 @@ export const auth = betterAuth({
return;
}

// Send verification email for admin-created users
const callbackURL = process.env.EMAIL_VERIFICATION_REDIRECT_URL?.trim() || process.env.FRONTEND_SOURCE?.trim();

void auth.api
.sendVerificationEmail({
body: {
email,
callbackURL,
},
})
.catch((error) => {
console.error('Error triggering verification email:', error);
});
// Auto-verify email for admin-created users (trusted operation)
try {
await db.update(user).set({ emailVerified: true }).where(eq(user.email, email));
} catch (error) {
console.error('Error auto-verifying admin-created user:', error);
}
}),
},

Expand Down
Loading