remove weird func

master
Aevann 2024-11-14 19:14:11 +02:00
parent f19561d056
commit ec66e6ad43
1 changed files with 6 additions and 10 deletions

View File

@ -98,7 +98,12 @@ def login_post(v):
else: else:
stop(400) stop(400)
on_login(account) session.permanent = True
session["lo_user"] = account.id
g.v = account
g.username = account.username
session["login_nonce"] = account.login_nonce
check_for_alts(account, include_current_session=True)
if redir and is_site_url(redir) and redir not in NO_LOGIN_REDIRECT_URLS: if redir and is_site_url(redir) and redir not in NO_LOGIN_REDIRECT_URLS:
return redirect(redir) return redirect(redir)
@ -111,15 +116,6 @@ def log_failed_admin_login_attempt(account, type):
t = time.strftime("%d/%B/%Y %H:%M:%S UTC", time.gmtime(time.time())) t = time.strftime("%d/%B/%Y %H:%M:%S UTC", time.gmtime(time.time()))
log_file(f"{t}, {ip}, {account.username}, {type}", "admin_failed_logins.log") log_file(f"{t}, {ip}, {account.username}, {type}", "admin_failed_logins.log")
def on_login(account, redir=None):
session.permanent = True
session["lo_user"] = account.id
g.v = account
g.username = account.username
session["login_nonce"] = account.login_nonce
check_for_alts(account, include_current_session=True)
@app.get("/me") @app.get("/me")
@limiter.limit(DEFAULT_RATELIMIT, deduct_when=lambda response: response.status_code < 400) @limiter.limit(DEFAULT_RATELIMIT, deduct_when=lambda response: response.status_code < 400)
@limiter.limit(DEFAULT_RATELIMIT, deduct_when=lambda response: response.status_code < 400, key_func=get_ID) @limiter.limit(DEFAULT_RATELIMIT, deduct_when=lambda response: response.status_code < 400, key_func=get_ID)