We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 27e7aca commit 4fc5274Copy full SHA for 4fc5274
1 file changed
app/routes/me_.passkeys.tsx
@@ -30,11 +30,19 @@ export async function action({ request }: Route.ActionArgs) {
30
const passkeyId = formData.get('passkeyId')
31
32
if (intent === 'delete' && typeof passkeyId === 'string') {
33
+ // First verify the passkey exists and belongs to the user
34
+ const passkey = await prisma.passkey.findUnique({
35
+ where: { id: passkeyId },
36
+ select: { userId: true },
37
+ })
38
+
39
+ if (!passkey || passkey.userId !== user.id) {
40
+ throw new Response('Passkey not found', { status: 404 })
41
+ }
42
43
+ // Delete using only the unique identifier
44
await prisma.passkey.delete({
- where: {
- id: passkeyId,
- userId: user.id, // Ensure the passkey belongs to the user
- },
45
46
})
47
}
48
0 commit comments