-
-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
feat: Add conditional email verification via dynamic Parse Server options verifyUserEmails
, sendUserEmailVerification
that now accept functions
#8425
Conversation
I will reformat the title to use the proper commit message syntax. |
Thanks for opening this pull request! |
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## alpha #8425 +/- ##
==========================================
+ Coverage 94.41% 94.44% +0.03%
==========================================
Files 184 184
Lines 14613 14644 +31
==========================================
+ Hits 13797 13831 +34
+ Misses 816 813 -3
☔ View full report in Codecov by Sentry. |
The discussion in the issue crystallized 3 distinct functionalities:
Looking at the PR it seem to cover (b) and (c) but not (a), is that correct? |
Yes, that is correct. How would option (a) work? Perhaps |
Maybe we can make use of triggers. I guess it depends where in the code it is relevant whether a user needs to verify their email. Is that checked at the login endpoint, before trying to create session? |
I'm thinking:
With #8449, this could be defined using: Parse.Server.setVerifyUserEmails(req => {
return req.object.email !== 'test@example.com'
}); Parse.Server.setPreventLoginWithUnverifiedEmail(req => {
return req.object.email !== 'test@example.com'
}); |
That sounds like mixing (a) and (c). The use case originally discussed (see lower part of #7144 (comment)) is an interesting one where (c) is controlled discretely.
Sounds good. The function could offer the request object as argument to determine user and installation. I think this mechanism is an additional feature to (a), (b), (c).
Yes, we need to get the order right then. For example if a user is set to There seems to be an implicit hierarchy, which we could use as guidance to design the flow.
(3) could be merged into (2) by returning a tuple of bools or maybe allowing to modify the arguments and then reading them out. At first glance a separate function seems cleaner, maybe that will require to lookup a user twice as I think there wouldn't be any way to pass values between (2) and (3). If instead of allowing functions as server options we add new CC triggers then a context container would be available to pass values around. I'm wondering whether extending server options to functions is a good direction if we have triggers that are a more capable feature. But it may be easier to implement. |
I'm not sure the difference in your suggestion between Some comments on my implementation:
|
The general idea is to disassemble the flow to allow developers to control each of the steps. So your question is, whether there is a use case where a developer wants to say "this email is not verified", but also "don't send a verification email". If both are in one step, then the developer can only say:
For sign-up:
For login:
So how does the flow currently look like? I'm guessing:
And how does it look like for sign-up vs. login? |
I have added a config option
|
Signed-off-by: Manuel <5673677+mtrezza@users.noreply.github.com>
Is this ready for merge? I just added #8425 (comment), if you agree... |
Signed-off-by: Daniel <daniel-blyth@live.com.au>
There seems to be an issue with a test in this PR. |
@dblythy The tests pass, can we merge? |
Yep! |
# [6.3.0-alpha.2](6.3.0-alpha.1...6.3.0-alpha.2) (2023-06-20) ### Features * Add conditional email verification via dynamic Parse Server options `verifyUserEmails`, `sendUserEmailVerification` that now accept functions ([#8425](#8425)) ([44acd6d](44acd6d))
🎉 This change has been released in version 6.3.0-alpha.2 |
# [6.4.0-beta.1](6.3.0...6.4.0-beta.1) (2023-09-16) ### Bug Fixes * Parse Server option `fileUpload.fileExtensions` does not work with an array of extensions ([#8688](#8688)) ([6a4a00c](6a4a00c)) * Redis 4 does not reconnect after unhandled error ([#8706](#8706)) ([2b3d4e5](2b3d4e5)) * Remove config logging when launching Parse Server via CLI ([#8710](#8710)) ([ae68f0c](ae68f0c)) * Server does not start via CLI when `auth` option is set ([#8666](#8666)) ([4e2000b](4e2000b)) ### Features * Add conditional email verification via dynamic Parse Server options `verifyUserEmails`, `sendUserEmailVerification` that now accept functions ([#8425](#8425)) ([44acd6d](44acd6d)) * Add property `Parse.Server.version` to determine current version of Parse Server in Cloud Code ([#8670](#8670)) ([a9d376b](a9d376b)) * Add TOTP authentication adapter ([#8457](#8457)) ([cc079a4](cc079a4)) ### Performance Improvements * Improve performance of recursive pointer iterations ([#8741](#8741)) ([45a3ed0](45a3ed0))
🎉 This change has been released in version 6.4.0-beta.1 |
# [6.4.0-alpha.1](6.3.0...6.4.0-alpha.1) (2023-09-20) ### Bug Fixes * Parse Server option `fileUpload.fileExtensions` does not work with an array of extensions ([#8688](#8688)) ([6a4a00c](6a4a00c)) * Redis 4 does not reconnect after unhandled error ([#8706](#8706)) ([2b3d4e5](2b3d4e5)) * Remove config logging when launching Parse Server via CLI ([#8710](#8710)) ([ae68f0c](ae68f0c)) * Server does not start via CLI when `auth` option is set ([#8666](#8666)) ([4e2000b](4e2000b)) ### Features * Add conditional email verification via dynamic Parse Server options `verifyUserEmails`, `sendUserEmailVerification` that now accept functions ([#8425](#8425)) ([44acd6d](44acd6d)) * Add context to Cloud Code Triggers `beforeLogin` and `afterLogin` ([#8724](#8724)) ([a9c34ef](a9c34ef)) * Add property `Parse.Server.version` to determine current version of Parse Server in Cloud Code ([#8670](#8670)) ([a9d376b](a9d376b)) * Add TOTP authentication adapter ([#8457](#8457)) ([cc079a4](cc079a4)) ### Performance Improvements * Improve performance of recursive pointer iterations ([#8741](#8741)) ([45a3ed0](45a3ed0))
🎉 This change has been released in version 6.4.0-alpha.1 |
# [6.4.0](6.3.1...6.4.0) (2023-11-16) ### Bug Fixes * Parse Server option `fileUpload.fileExtensions` does not work with an array of extensions ([#8688](#8688)) ([6a4a00c](6a4a00c)) * Redis 4 does not reconnect after unhandled error ([#8706](#8706)) ([2b3d4e5](2b3d4e5)) * Remove config logging when launching Parse Server via CLI ([#8710](#8710)) ([ae68f0c](ae68f0c)) * Server does not start via CLI when `auth` option is set ([#8666](#8666)) ([4e2000b](4e2000b)) ### Features * Add conditional email verification via dynamic Parse Server options `verifyUserEmails`, `sendUserEmailVerification` that now accept functions ([#8425](#8425)) ([44acd6d](44acd6d)) * Add property `Parse.Server.version` to determine current version of Parse Server in Cloud Code ([#8670](#8670)) ([a9d376b](a9d376b)) * Add TOTP authentication adapter ([#8457](#8457)) ([cc079a4](cc079a4)) ### Performance Improvements * Improve performance of recursive pointer iterations ([#8741](#8741)) ([45a3ed0](45a3ed0))
🎉 This change has been released in version 6.4.0 |
Pull Request
Issue
Currently it is not possible to decide what users should and shouldn't receive verification emails.
Closes: #7144
Approach
wip
Tasks