forked from rDrama/rDrama
fdfd
parent
aa8f0ce9d6
commit
db49836ed9
|
@ -1,3 +1,5 @@
|
||||||
|
from random import vonmisesvariate
|
||||||
|
from sqlalchemy.sql import visitors
|
||||||
from werkzeug.wrappers.response import Response as RespObj
|
from werkzeug.wrappers.response import Response as RespObj
|
||||||
from .get import *
|
from .get import *
|
||||||
from .alerts import send_notification
|
from .alerts import send_notification
|
||||||
|
@ -8,35 +10,24 @@ def get_logged_in_user():
|
||||||
|
|
||||||
if request.headers.get("Authorization"):
|
if request.headers.get("Authorization"):
|
||||||
token = request.headers.get("Authorization")
|
token = request.headers.get("Authorization")
|
||||||
if not token: return None, None
|
if not token: return None
|
||||||
|
|
||||||
client = g.db.query(ClientAuth).filter(ClientAuth.access_token == token).first()
|
client = g.db.query(ClientAuth).filter(ClientAuth.access_token == token).first()
|
||||||
|
if client: return client.user
|
||||||
x = (client.user, client) if client else (None, None)
|
else: return None
|
||||||
|
|
||||||
|
|
||||||
else:
|
else:
|
||||||
|
id = session.get("user_id")
|
||||||
uid = session.get("user_id")
|
|
||||||
nonce = session.get("login_nonce", 0)
|
nonce = session.get("login_nonce", 0)
|
||||||
if not uid: x= (None, None)
|
if not id: return None
|
||||||
v = g.db.query(User).filter_by(id=uid).first()
|
v = g.db.query(User).filter_by(id=id).first()
|
||||||
|
|
||||||
if v and v.agendaposter_expires_utc and v.agendaposter_expires_utc < g.timestamp:
|
if v and v.agendaposter_expires_utc and v.agendaposter_expires_utc < g.timestamp:
|
||||||
v.agendaposter_expires_utc = 0
|
v.agendaposter_expires_utc = 0
|
||||||
v.agendaposter = False
|
v.agendaposter = False
|
||||||
|
|
||||||
g.db.add(v)
|
g.db.add(v)
|
||||||
|
|
||||||
if v and (nonce < v.login_nonce):
|
if v and (nonce < v.login_nonce): return None
|
||||||
x= (None, None)
|
return v
|
||||||
else:
|
|
||||||
x=(v, None)
|
|
||||||
|
|
||||||
|
|
||||||
if x[0]: x[0].client=x[1]
|
|
||||||
|
|
||||||
return x
|
|
||||||
|
|
||||||
|
|
||||||
def check_ban_evade(v):
|
def check_ban_evade(v):
|
||||||
|
|
Loading…
Reference in New Issue