master
Aevann1 2021-12-19 23:41:57 +02:00
parent f7b8d85032
commit 45b11cfc47
3 changed files with 18 additions and 43 deletions

View File

@ -369,11 +369,7 @@ def sign_up_post(v):
@app.get("/forgot")
def get_forgot():
if v and v.oldsite: template = ''
else: template = 'CHRISTMAS/'
return render_template(f"{template}forgot_password.html",
)
return render_template(f"forgot_password.html")
@app.post("/forgot")
@ -410,9 +406,7 @@ def post_forgot():
v=user)
)
if v and v.oldsite: template = ''
else: template = 'CHRISTMAS/'
return render_template(f"{template}forgot_password.html",
return render_template(f"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.")
@ -426,9 +420,7 @@ def get_reset():
now = int(time.time())
if now - timestamp > 600:
if v and v.oldsite: template = ''
else: template = 'CHRISTMAS/'
return render_template(f"{template}message.html",
return render_template(f"message.html",
title="Password reset link expired",
error="That password reset link has expired.")
@ -442,9 +434,7 @@ def get_reset():
reset_token = generate_hash(f"{user.id}+{timestamp}+reset+{user.login_nonce}")
if v and v.oldsite: template = ''
else: template = 'CHRISTMAS/'
return render_template(f"{template}reset_password.html",
return render_template(f"reset_password.html",
v=user,
token=reset_token,
time=timestamp,
@ -519,9 +509,7 @@ def request_2fa_disable():
username=request.values.get("username")
user=get_user(username, graceful=True)
if not user or not user.email or not user.mfa_secret:
if v and v.oldsite: template = ''
else: template = 'CHRISTMAS/'
return render_template(f"{template}message.html",
return render_template(f"message.html",
title="Removal request received",
message="If username, password, and email match, we will send you an email.")
@ -533,18 +521,14 @@ def request_2fa_disable():
email=email.replace('.','').replace('_','')
email=f"{email}@gmail.com"
if email != user.email:
if v and v.oldsite: template = ''
else: template = 'CHRISTMAS/'
return render_template(f"{template}message.html",
return render_template(f"message.html",
title="Removal request received",
message="If username, password, and email match, we will send you an email.")
password =request.values.get("password")
if not user.verifyPass(password):
if v and v.oldsite: template = ''
else: template = 'CHRISTMAS/'
return render_template(f"{template}message.html",
return render_template(f"message.html",
title="Removal request received",
message="If username, password, and email match, we will send you an email.")
@ -560,9 +544,7 @@ def request_2fa_disable():
v=user)
)
if v and v.oldsite: template = ''
else: template = 'CHRISTMAS/'
return render_template(f"{template}message.html",
return render_template(f"message.html",
title="Removal request received",
message="If username, password, and email match, we will send you an email.")
@ -573,9 +555,7 @@ def reset_2fa():
t=int(request.values.get("t"))
if now > t+3600*24:
if v and v.oldsite: template = ''
else: template = 'CHRISTMAS/'
return render_template(f"{template}message.html",
return render_template(f"message.html",
title="Expired Link",
error="That link has expired.")
@ -593,8 +573,6 @@ def reset_2fa():
g.db.commit()
if v and v.oldsite: template = ''
else: template = 'CHRISTMAS/'
return render_template(f"{template}message_success.html",
return render_template(f"message_success.html",
title="Two-factor authentication removed.",
message="Login normally to access your account.")

View File

@ -71,7 +71,9 @@ def searchposts(v):
if 'over18' in criteria: posts = posts.filter(Submission.over_18==True)
if 'author' in criteria: posts = posts.filter(Submission.author_id == get_user(criteria['author']).id)
if 'author' in criteria:
author = get_user(criteria['author'])
if not author.is_private: posts = posts.filter(Submission.author_id == author.id)
if 'domain' in criteria:
domain=criteria['domain']
@ -92,9 +94,7 @@ def searchposts(v):
)
)
if not (v and v.admin_level > 1):
posts = posts.filter(Submission.deleted_utc == 0, Submission.is_banned == False)
if not (v and v.eye): posts = posts.join(User, User.id==Submission.author_id).filter(User.is_private == False)
if not (v and v.admin_level > 1): posts = posts.filter(Submission.deleted_utc == 0, Submission.is_banned == False)
if v and v.admin_level > 1: pass
elif v:
@ -204,10 +204,11 @@ def searchcomments(v):
if 'over18' in criteria: comments = comments.filter(Comment.over_18==True)
if 'author' in criteria: comments = comments.filter(Comment.author_id == get_user(criteria['author']).id)
if 'author' in criteria:
author = get_user(criteria['author'])
if not author.is_private: comments = comments.filter(Comment.author_id == author.id)
if not(v and v.admin_level > 1):
comments = comments.join(User, User.id==Comment.author_id).filter(User.is_private == False, Comment.deleted_utc == 0, Comment.is_banned == False)
if not(v and v.admin_level > 1): comments = comments.filter(Comment.deleted_utc == 0, Comment.is_banned == False)
if t:
now = int(time.time())

View File

@ -79,10 +79,6 @@
background-color: var(--primary)!important;
}
.award-columns {
column-count: 2;
}
@media (min-width: 767.98px) {
.award-columns {
column-count: 7 !important;