Closed ritchieng closed 8 years ago
Found a fix.
If anyone's experiencing the same issue do the following in your server/accounts.js:
Accounts.onCreateUser(function(options, user) {
if (options.profile)
user.profile = options.profile;
var email = getUserEmail(user);
if(email){
user.emailHash = CryptoJS.MD5(email.trim().toLowerCase()).toString();
}
if (!user.emails) {
user.emails = [{address: user.services.facebook.email, verified: false}];
}
return user;
});
looks good - except, it should likely be
`` if(!user.emails && user.services && user.services.facebook && user.services.facebook.email) user.emails = user.services.facebook.email
you should only pull in the facebook email if it exists
without this, signing up up with non-facebook oauth that doesnt have email
address will cause user.services.facebook to be undefined and throw an error
On Mon, Mar 7, 2016 at 4:47 PM, ritchieng <notifications@github.com> wrote:
> Closed #90 <https://github.com/nate-strauser/wework/issues/90>.
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/nate-strauser/wework/issues/90#event-580828804>.
>
Thanks. I tried your fix and it doesn't work though, it gave an internal server error when signing in.
braces {} are optional if its just 1 line after the 'if(...)' - totally fine to always use braces though
On Mon, Mar 7, 2016 at 4:57 PM, ritchieng notifications@github.com wrote:
You're really good, I'm still new at this. Haha.
You need a {} right? Like this:
if(!user.emails && user.services && user.services.facebook && user.services.facebook.email) { user.emails = user.services.facebook.email }
— Reply to this email directly or view it on GitHub https://github.com/nate-strauser/wework/issues/90#issuecomment-193473666 .
Hi,
If a user were to use Facebook login, their emails won't be available in the admin panel.
As a result:
Any fix to this? Really appreciate it.
Thanks!