fix: Force unique usernames

Force unique usernames by using the username plugin for BetterAuth
This commit is contained in:
April Hall 2025-02-09 22:39:40 -05:00
parent 360fbc644d
commit 7e9e1da56e
Signed by: arithefirst
GPG Key ID: 4508A15C4DB91C5B
2 changed files with 3 additions and 0 deletions

View File

@ -1,4 +1,5 @@
import { betterAuth } from 'better-auth'; import { betterAuth } from 'better-auth';
import { username } from 'better-auth/plugins';
import Database from 'better-sqlite3'; import Database from 'better-sqlite3';
export const auth = betterAuth({ export const auth = betterAuth({
@ -7,4 +8,5 @@ export const auth = betterAuth({
enabled: true, enabled: true,
autoSignIn: true, autoSignIn: true,
}, },
plugins: [username()],
}); });

View File

@ -37,6 +37,7 @@ export const actions = {
name, name,
email, email,
password, password,
username: name,
}, },
asResponse: true, asResponse: true,
}); });