Skip to content

Commit

Permalink
dont allow to register fb users without email Closes #1001
Browse files Browse the repository at this point in the history
  • Loading branch information
mjlescano committed Aug 6, 2015
1 parent 39a1794 commit 43aeb5d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lib/auth-facebook/strategy.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,12 @@ module.exports = function() {
User.findByProvider(profile, function (err, user) {
if (err) return done(err);

if (!user) return signup(profile, accessToken, done);
if (!user) {
if (!profile.emails) {
return done(new Error(t('signup.facebook.need-email-error')));
}
return signup(profile, accessToken, done);
}

var email = profile._json.email;
if (user.email !== email) {
Expand Down
1 change: 1 addition & 0 deletions lib/translations/lib/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,7 @@
"signup.email": "Email",
"signup.email-sent": "Email sent",
"signup.email-validated": "Your email has been validated and now you are logged in",
"signup.facebook.need-email-error": "To signup you need to have configured an email on your facebook account.",
"signup.firstname": "Firstname",
"signup.go-to": "Go to",
"signup.lastname": "Lastname",
Expand Down

0 comments on commit 43aeb5d

Please sign in to comment.