-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Verification email is sent even if verified is checked in UI #10158
Comments
Hey @tylkomat — unfortunately if we respected the incoming initial Consider this case:
The user is now able to circumvent the verification requirement easily. There are two fixes here that come to mind: 1 - I think we should remove the 2 - if you want to respect the const users: CollectionConfig = {
slug: 'users',
auth: {
verify: true,
},
hooks: {
beforeOperation: [
({ args, operation, req }) => {
if (operation === 'create' && req.user && args.data._verified) {
args.disableVerificationEmail = true
return args
}
return args
}
]
},
fields: [
// none
],
} This will successfully disable the verification email, if there is a user logged in, and the person who created the user did indeed specify |
That works for me. Thank you. |
This issue has been automatically locked. |
🚀 This is included in version v3.13.0 |
Describe the Bug
When creating a user and
auth.verify
is true on the collection, the verification email is sent despite havingverified
checked in UI. TheverificationToken
is also generated.Missing check for
resultWithLocales._verified
or!verificationToken
: https://github.com/payloadcms/payload/blob/main/packages/payload/src/collections/operations/create.ts#L256Missing Check for
result._verified === true
: https://github.com/payloadcms/payload/blob/main/packages/payload/src/collections/operations/create.ts#L298Link to the code that reproduces this issue
https://github.com/tylkomat/payload/tree/bug-verification-email
Reproduction Steps
verify
to true on user collectionverified
checkbox, hit saveINFO: Email attempted without being configured. To: ...
Which area(s) are affected? (Select all that apply)
area: core
Environment Info
The text was updated successfully, but these errors were encountered: