You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Local API verifyEmail throws an error instead of returning false #14682
// Returned result will be a boolean representing success or failureconstresult=awaitpayload.verifyEmail({collection: 'users',// requiredtoken: 'afh3o2jf2p3f...',// the token saved on the user as `_verificationToken`})
But while using this method I figured it is never returning false but throwing an error instead. This can be a problem if someone (like me 😄) expects a boolean value for a graceful handling of a false case.
Additional Details
Instead of changing the documentation I would rather propose to change the method to create the behavior described in the docs.
The proposal would be to change this line when a user with the verify token wasn't found verifyEmail.ts L46
// Beforeif(!user){thrownewAPIError('Verification token is invalid.',httpStatus.FORBIDDEN)}// Afterif(!user){returnfalse}
The same problem might exist for REST and GraphQL as well.
Activity
chore: address six more Payload reports and prepare the fork PR
fix: address 24 Payload read, schema, version and tooling reports (#9)