Skip to content

Commit

Permalink
Fix get user by email with insensitive (#15)
Browse files Browse the repository at this point in the history
  • Loading branch information
newarifrh authored Sep 30, 2024
2 parents a08962f + 76f8731 commit 9d767a4
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 9d767a4

Please sign in to comment.