feat(auth): update user lookup to support name or email in authentication
Some checks failed
container-scan / Container Scan (pull_request) Failing after 6m14s
docker-build / docker (pull_request) Successful in 10m13s

When testing api endpoints make sure to login with a real user (not with the dev hardcoded user) by either registering one with a password other than "password" or setting DISABLE_AUTH_TEST_USER to "true" (`DISABLE_AUTH_TEST_USER=true yarn dev`)
This commit is contained in:
Dominik 2025-06-14 11:45:14 +02:00
parent a19b4d526b
commit c9ccf24c13
Signed by: dominik
GPG key ID: 06A4003FC5049644

View file

@ -25,7 +25,7 @@ const providers: Provider[] = [
Credentials({
credentials: { password: { label: 'Password', type: 'password' } },
async authorize(c) {
if (process.env.NODE_ENV === 'development' && c.password === 'password')
if (process.env.NODE_ENV === 'development' && process.env.DISABLE_AUTH_TEST_USER !== 'true' && c.password === 'password')
return {
id: 'test',
name: 'Test User',
@ -37,7 +37,7 @@ const providers: Provider[] = [
const { email, password } = await loginSchema.parseAsync(c);
const user = await prisma.user.findFirst({
where: { email },
where: { OR: [{ email }, { name: email }] },
include: { accounts: true },
});