Skip to content

Commit

Permalink
feat(provider): add option to generate email verification token (#541)
Browse files Browse the repository at this point in the history
* 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 <yo@ndo.dev>
Co-authored-by: Balázs Orbán <info@balazsorban.com>
  • Loading branch information
3 people committed Jan 19, 2021
1 parent b3c7617 commit 47bcd1e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/server/lib/signin/email.js
Expand Up @@ -10,7 +10,7 @@ export default async function email (email, provider, options) {
const secret = provider.secret || options.secret

// Generate token
const token = randomBytes(32).toString('hex')
const token = provider.generateVerificationToken?.() ?? randomBytes(32).toString('hex')

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

0 comments on commit 47bcd1e

Please sign in to comment.