Skip to content

Commit 47bcd1e

Browse files
firedendom91balazsorban44
authored
feat(provider): add option to generate email verification token (#541)
* Add option to generate email verification token * chore: remove unused import * refactor: define default generateVerificationToken in-place * refactor: define default generateVerificationToken in-place Co-authored-by: Nico Domino <[email protected]> Co-authored-by: Balázs Orbán <[email protected]>
1 parent b3c7617 commit 47bcd1e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/server/lib/signin/email.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export default async function email (email, provider, options) {
1010
const secret = provider.secret || options.secret
1111

1212
// Generate token
13-
const token = randomBytes(32).toString('hex')
13+
const token = provider.generateVerificationToken?.() ?? randomBytes(32).toString('hex')
1414

1515
// Send email with link containing token (the unhashed version)
1616
const url = `${baseUrl}${basePath}/callback/${encodeURIComponent(provider.id)}?email=${encodeURIComponent(email)}&token=${encodeURIComponent(token)}`

0 commit comments

Comments
 (0)