forked from rDrama/rDrama
1
0
Fork 0
master
Aevann1 2021-08-19 07:45:22 +02:00
parent 6abda65e2d
commit 5e2917a77d
2 changed files with 4 additions and 24 deletions

View File

@ -1,9 +1,5 @@
from sqlalchemy import * from sqlalchemy import *
from flask import g
from files.__main__ import Base from files.__main__ import Base
from os import environ
site = environ.get("DOMAIN").strip()
class Image(Base): class Image(Base):
__tablename__ = "images" __tablename__ = "images"
@ -14,12 +10,6 @@ class Image(Base):
deletehash = Column(String(64)) deletehash = Column(String(64))
def random_image():
n=g.db.query(Image).count()
return g.db.query(Image).order_by(Image.id.asc()).first()
class BadPic(Base): class BadPic(Base):
#Class for tracking fuzzy hashes of banned csam images #Class for tracking fuzzy hashes of banned csam images

View File

@ -16,7 +16,6 @@ def login_get(v):
return render_template("login.html", return render_template("login.html",
failed=False, failed=False,
i=random_image(),
redirect=redir) redirect=redir)
@ -65,7 +64,7 @@ def login_post():
if not account: if not account:
time.sleep(random.uniform(0, 2)) time.sleep(random.uniform(0, 2))
return render_template("login.html", failed=True, i=random_image()) return render_template("login.html", failed=True)
# test password # test password
@ -73,7 +72,7 @@ def login_post():
if not account.verifyPass(request.form.get("password")): if not account.verifyPass(request.form.get("password")):
time.sleep(random.uniform(0, 2)) time.sleep(random.uniform(0, 2))
return render_template("login.html", failed=True, i=random_image()) return render_template("login.html", failed=True)
if account.mfa_secret: if account.mfa_secret:
now = int(time.time()) now = int(time.time())
@ -82,7 +81,6 @@ def login_post():
v=account, v=account,
time=now, time=now,
hash=hash, hash=hash,
i=random_image(),
redirect=request.form.get("redirect", "/") redirect=request.form.get("redirect", "/")
) )
elif request.form.get("2fa_token", "x"): elif request.form.get("2fa_token", "x"):
@ -104,7 +102,6 @@ def login_post():
time=now, time=now,
hash=hash, hash=hash,
failed=True, failed=True,
i=random_image()
) )
else: else:
@ -170,8 +167,7 @@ def sign_up_get(v):
ref_user = None ref_user = None
if ref_user and (ref_user.id in session.get("history", [])): if ref_user and (ref_user.id in session.get("history", [])):
return render_template("sign_up_failed_ref.html", return render_template("sign_up_failed_ref.html")
i=random_image())
# Make a unique form key valid for one account creation # Make a unique form key valid for one account creation
now = int(time.time()) now = int(time.time())
@ -194,7 +190,6 @@ def sign_up_get(v):
return render_template("sign_up.html", return render_template("sign_up.html",
formkey=formkey, formkey=formkey,
now=now, now=now,
i=random_image(),
redirect=redir, redirect=redir,
ref_user=ref_user, ref_user=ref_user,
error=error, error=error,
@ -373,7 +368,6 @@ def sign_up_post(v):
def get_forgot(): def get_forgot():
return render_template("forgot_password.html", return render_template("forgot_password.html",
i=random_image()
) )
@ -409,8 +403,7 @@ def post_forgot():
) )
return render_template("forgot_password.html", return render_template("forgot_password.html",
msg="If the username and email matches an account, you will be sent a password reset email. You have ten minutes to complete the password reset process.", msg="If the username and email matches an account, you will be sent a password reset email. You have ten minutes to complete the password reset process.")
i=random_image())
@app.get("/reset") @app.get("/reset")
@ -441,7 +434,6 @@ def get_reset():
v=user, v=user,
token=reset_token, token=reset_token,
time=timestamp, time=timestamp,
i=random_image()
) )
@ -477,7 +469,6 @@ def post_reset(v):
v=user, v=user,
token=token, token=token,
time=timestamp, time=timestamp,
i=random_image(),
error="Passwords didn't match.") error="Passwords didn't match.")
user.passhash = hash_password(password) user.passhash = hash_password(password)
@ -493,7 +484,6 @@ def lost_2fa(v):
return render_template( return render_template(
"lost_2fa.html", "lost_2fa.html",
i=random_image(),
v=v v=v
) )