Fix GitHub login by making username case insensitive
This commit is contained in:
parent
a0814f4792
commit
5c13200429
|
@ -18,6 +18,7 @@
|
||||||
from flask import *
|
from flask import *
|
||||||
from flask_user import *
|
from flask_user import *
|
||||||
from flask_login import login_user, logout_user
|
from flask_login import login_user, logout_user
|
||||||
|
from sqlalchemy import func
|
||||||
import flask_menu as menu
|
import flask_menu as menu
|
||||||
from flask_github import GitHub
|
from flask_github import GitHub
|
||||||
from app import app, github
|
from app import app, github
|
||||||
|
@ -44,7 +45,7 @@ def github_authorized(oauth_token):
|
||||||
username = r.json()["login"]
|
username = r.json()["login"]
|
||||||
|
|
||||||
# Get user by github username
|
# Get user by github username
|
||||||
userByGithub = User.query.filter_by(github_username=username).first()
|
userByGithub = User.query.filter(func.lower(User.github_username) == func.lower(username)).first()
|
||||||
|
|
||||||
# If logged in, connect
|
# If logged in, connect
|
||||||
if current_user and current_user.is_authenticated:
|
if current_user and current_user.is_authenticated:
|
||||||
|
|
Loading…
Reference in New Issue