fix facebook might not return email

This commit is contained in:
Son NK 2020-04-24 09:17:21 +02:00
parent 0f71eff531
commit 6a67f7946f
1 changed files with 2 additions and 1 deletions

View File

@ -86,7 +86,7 @@ def facebook_callback():
"https://graph.facebook.com/me?fields=id,name,email,picture{url}"
).json()
email = facebook_user_data.get("email").strip().lower()
email = facebook_user_data.get("email")
# user choose to not share email, cannot continue
if not email:
@ -95,6 +95,7 @@ def facebook_callback():
)
return redirect(url_for("auth.register"))
email = email.strip().lower()
user = User.get_by(email=email)
picture_url = facebook_user_data.get("picture", {}).get("data", {}).get("url")