-
Notifications
You must be signed in to change notification settings - Fork 228
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
feature: Make email optional #70
feature: Make email optional #70
Conversation
Can one of the admins verify this patch? To accept patch and trigger a build add comment ".ok\W+to\W+test." |
@BerkeleyTrue Please sign the CLA at - https://cla.strongloop.com/agreements/strongloop/loopback-component-passport |
signed |
var userObj = (options.profileToUser || profileToUser)(provider, profile); | ||
if (!userObj.email) { | ||
var userObj = (options.profileToUser || profileToUser)(provider, profile, options); | ||
if (!userObj.email && !options.emailOptional) { | ||
return cb('email is missing from the user profile'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's do this shortcut within a process.nextTick
block.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure what you mean. wrap line 117 in a process.nextTick?
Had to change the query structure. In certain situations user identities where being assigned to random user documents. I also wrapped the callback in a nextTick |
👍 |
ok to test |
@raymondfeng Any feedback on this? |
feature: Make email optional
woot! |
return cb('email is missing from the user profile'); | ||
var userObj = (options.profileToUser || profileToUser)(provider, profile, options); | ||
if (!userObj.email && !options.emailOptional) { | ||
process.nextTick(function() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We're integrating loopback-component-passport into our Loopback app and are having some trouble understanding this code. Why is the nextTick
required here - it seems like it allows the execution to fall through and to create the member even if the email is not available.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@alexpit You are correct, this is indeed a bug. There is a missing return before the process.nextTick.
Can you file an issue and maybe create a PR?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@BerkeleyTrue will do - thanks very much for your response!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks. I'm surprised this hasn't been caught earlier.
Only add email field to user object if available and not optional. This way emails can still be indexed with sparse indexing.
closes #66