Skip to content

Commit

Permalink
fix(providers): optionally check identifier
Browse files Browse the repository at this point in the history
  • Loading branch information
balazsorban44 committed Sep 25, 2024
1 parent 174f63c commit 54ba689
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions packages/core/src/lib/actions/callback/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -220,11 +220,15 @@ export async function callback(
const hasInvite = !!invite
const expired = hasInvite && invite.expires.valueOf() < Date.now()
const invalidInvite =
!hasInvite || expired || invite.identifier !== paramIdentifier
!hasInvite ||
expired ||
// The user might have configured the link to not contain the identifier
// so we only compare if it exists
(paramIdentifier && invite.identifier !== paramIdentifier)
if (invalidInvite) throw new Verification({ hasInvite, expired })

const { identifier } = invite
const user = (await adapter!.getUserByEmail(paramIdentifier)) ?? {
const user = (await adapter!.getUserByEmail(identifier)) ?? {
id: crypto.randomUUID(),
email: identifier,
emailVerified: null,
Expand Down

0 comments on commit 54ba689

Please sign in to comment.