⚡️⚡️⚡️ Self-hosted collaborative bookmark manager to collect, read, annotate, and fully preserve what matters, all in one place.
TypeScript bookmarkbookmark-managercollaborationnextjsreact-nativeread-it-laterself-hostedtypescript
security checks
daniel31x132a96b614746a
diff --git a/apps/web/pages/api/v1/auth/mobile/apple.ts b/apps/web/pages/api/v1/auth/mobile/apple.tsindex 2afd3bd0..dc5de6ea 100644--- a/apps/web/pages/api/v1/auth/mobile/apple.ts+++ b/apps/web/pages/api/v1/auth/mobile/apple.ts@@ -30,7 +30,9 @@ export default async function appleMobileAuth(return res.status(401).json({ response: "Invalid Apple identity token." });}- const email = claims.email?.toLowerCase();+ const emailVerified =+ claims.email_verified === true || claims.email_verified === "true";+ const email = emailVerified ? claims.email?.toLowerCase() : undefined;let account = await prisma.account.findFirst({where: { provider: "apple", providerAccountId: claims.sub },@@ -40,9 +42,19 @@ export default async function appleMobileAuth(let user = account?.user;if (!user && email) {- user = (await prisma.user.findUnique({ where: { email } })) ?? undefined;+ const existingUser = await prisma.user.findUnique({+ where: { email },+ include: { accounts: true },+ });++ if (existingUser && existingUser.accounts.length > 0)+ return res.status(409).json({+ response:+ "An account with this email is already linked to another sign-in method.",+ });- if (user)+ if (existingUser) {+ user = existingUser;await prisma.account.create({data: {userId: user.id,@@ -51,6 +63,7 @@ export default async function appleMobileAuth(providerAccountId: claims.sub,},});+ }}if (!user) {