Skip to content

Commit

Permalink
FIX handle no email github accounts
Browse files Browse the repository at this point in the history
  • Loading branch information
wabscale committed Feb 2, 2024
1 parent ff76b82 commit fdb46f4
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion api/anubis/views/public/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from urllib.parse import urlunparse
from urllib.parse import quote

import json
import requests
from flask import Blueprint, make_response, redirect, request

Expand Down Expand Up @@ -163,9 +164,12 @@ def public_github_oauth():
headers=github_api_headers,
).json()

# Display user info
logger.info(f'github_user_info = {json.dumps(github_user_info, indent=2)}')

# Get minimal information for setting username
github_username = github_user_info["login"].strip()
name = github_user_info['name'].strip()
email = github_user_info['email'].strip()

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

# Grab email to use as netid
email = github_user_info['email'].strip()

# Create user
user = User(
netid=email,
Expand Down

0 comments on commit fdb46f4

Please sign in to comment.