forked from MarseyWorld/MarseyWorld
fix 500 errors
parent
b8597a1649
commit
07be18cd1b
|
@ -1042,12 +1042,14 @@ def ban_user(user_id, v):
|
||||||
|
|
||||||
if 'reason' in request.values:
|
if 'reason' in request.values:
|
||||||
if request.values["reason"].startswith("/post/"):
|
if request.values["reason"].startswith("/post/"):
|
||||||
post = int(request.values["reason"].split("/post/")[1].split(None, 1)[0])
|
try: post = int(request.values["reason"].split("/post/")[1].split(None, 1)[0])
|
||||||
|
except: abort(400)
|
||||||
post = get_post(post)
|
post = get_post(post)
|
||||||
post.bannedfor = f'{duration} by @{v.username}'
|
post.bannedfor = f'{duration} by @{v.username}'
|
||||||
g.db.add(post)
|
g.db.add(post)
|
||||||
elif request.values["reason"].startswith("/comment/"):
|
elif request.values["reason"].startswith("/comment/"):
|
||||||
comment = int(request.values["reason"].split("/comment/")[1].split(None, 1)[0])
|
try: comment = int(request.values["reason"].split("/comment/")[1].split(None, 1)[0])
|
||||||
|
except: abort(400)
|
||||||
comment = get_comment(comment)
|
comment = get_comment(comment)
|
||||||
comment.bannedfor = f'{duration} by @{v.username}'
|
comment.bannedfor = f'{duration} by @{v.username}'
|
||||||
g.db.add(comment)
|
g.db.add(comment)
|
||||||
|
|
|
@ -121,8 +121,11 @@ def login_post():
|
||||||
elif request.values.get("2fa_token", "x"):
|
elif request.values.get("2fa_token", "x"):
|
||||||
now = int(time.time())
|
now = int(time.time())
|
||||||
|
|
||||||
if now - int(request.values.get("time")) > 600:
|
try:
|
||||||
return redirect('/login')
|
if now - int(request.values.get("time")) > 600:
|
||||||
|
return redirect('/login')
|
||||||
|
except:
|
||||||
|
abort(400)
|
||||||
|
|
||||||
formhash = request.values.get("hash")
|
formhash = request.values.get("hash")
|
||||||
if not validate_hash(f"{account.id}+{request.values.get('time')}+2fachallenge", formhash):
|
if not validate_hash(f"{account.id}+{request.values.get('time')}+2fachallenge", formhash):
|
||||||
|
|
Loading…
Reference in New Issue