Skip to content

Commit

Permalink
fix: 🚑 correct get user by email with insensitive
Browse files Browse the repository at this point in the history
  • Loading branch information
newarifrh committed Sep 30, 2024
1 parent 52c14b0 commit 76f8731
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/services/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,12 @@ import { generateToken } from "@/utils/jwt";
import { getUserInfo } from "@/services/sso";

const login = async (email: string, password: string): Promise<Result<any>> => {
const user = await prisma.user.findUnique({
const user = await prisma.user.findFirst({
where: {
email: email,
email: {
equals: email,
mode: "insensitive",
},
},
});

Expand Down Expand Up @@ -42,9 +45,12 @@ const login = async (email: string, password: string): Promise<Result<any>> => {
const loginSso = async (tokenSso: string): Promise<Result<any>> => {
const userSso = await getUserInfo(tokenSso);

const user = await prisma.user.findUnique({
const user = await prisma.user.findFirst({
where: {
email: userSso.email,
email: {
equals: userSso.email,
mode: "insensitive",
},
},
});

Expand Down

0 comments on commit 76f8731

Please sign in to comment.