Skip to content

Commit fdb46f4

Browse files
committed
FIX handle no email github accounts
1 parent ff76b82 commit fdb46f4

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

api/anubis/views/public/auth.py

+8-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
from urllib.parse import urlunparse
33
from urllib.parse import quote
44

5+
import json
56
import requests
67
from flask import Blueprint, make_response, redirect, request
78

@@ -163,9 +164,12 @@ def public_github_oauth():
163164
headers=github_api_headers,
164165
).json()
165166

167+
# Display user info
168+
logger.info(f'github_user_info = {json.dumps(github_user_info, indent=2)}')
169+
170+
# Get minimal information for setting username
166171
github_username = github_user_info["login"].strip()
167172
name = github_user_info['name'].strip()
168-
email = github_user_info['email'].strip()
169173

170174
# If user exists
171175
if current_user is not None:
@@ -182,6 +186,9 @@ def public_github_oauth():
182186
# If user didn't already exist, we need to create one
183187
if user is None:
184188

189+
# Grab email to use as netid
190+
email = github_user_info['email'].strip()
191+
185192
# Create user
186193
user = User(
187194
netid=email,

0 commit comments

Comments
 (0)