IEEE.org     |     IEEE Xplore Digital Library     |     IEEE Standards     |     IEEE Spectrum     |     More Sites

Verified Commit 2613bd02 authored by Emi Simpson's avatar Emi Simpson
Browse files

[new arch] Remove messy imports

parent 0a4d5e4c
......@@ -13,6 +13,7 @@ from typing import Optional, Tuple, Union, cast
from argon2 import PasswordHasher
from pymysql.cursors import Cursor
from mystic.auth import AuthModule
from mystic.request import UserID
from flask import session, request, url_for
from flask.app import Flask
from random import randint
......@@ -211,9 +212,7 @@ class DirectAuth(AuthModule):
return User(cast(int, session['id']))
return None
from mystic.request import UserID
def check_userp(self) -> Optional[UserID]:
from mystic.request import UserID
if 'id' in session:
return UserID(cast(int, session['id']))
return None
......
......@@ -3,6 +3,7 @@ from typing import Optional
from pymysql.cursors import Cursor
from mystic.auth import AuthModule, update_user
from mystic.request import UserID
from flask.app import Flask
from flask.helpers import url_for
from flask_saml2.sp.sp import ServiceProvider
......@@ -50,9 +51,7 @@ class SamlAuth(AuthModule):
else:
return None
from mystic.request import UserID
def check_userp(self) -> Optional[UserID]:
from mystic.request import UserID # I couldn't tell you why this line needs to be here, but without it mypy freaks out
if self.service_provider.is_user_logged_in():
user_info = self.service_provider.get_auth_data_in_session().attributes
return UserID(int(user_info['uidNumber']))
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment