use abort(410) instead of the old message.html template

remotes/1693176582716663532/tmp_refs/heads/watchparty
justcool393 2022-11-15 23:32:57 -06:00
parent 219029f8a3
commit 1565d9ca26
3 changed files with 12 additions and 13 deletions

View File

@ -311,6 +311,7 @@ WERKZEUG_ERROR_DESCRIPTIONS = {
405: "The method is not allowed for the requested URL.", 405: "The method is not allowed for the requested URL.",
406: "The resource identified by the request is only capable of generating response entities which have content characteristics not acceptable according to the accept headers sent in the request.", 406: "The resource identified by the request is only capable of generating response entities which have content characteristics not acceptable according to the accept headers sent in the request.",
409: "A conflict happened while processing the request. The resource might have been modified while the request was being processed.", 409: "A conflict happened while processing the request. The resource might have been modified while the request was being processed.",
410: "The requested URL is no longer available on this server and there is no forwarding address. If you followed a link from a foreign page, please contact the author of this page.",
413: "The data value transmitted exceeds the capacity limit.", 413: "The data value transmitted exceeds the capacity limit.",
414: "The length of the requested URL exceeds the capacity limit for this server. The request cannot be processed.", 414: "The length of the requested URL exceeds the capacity limit for this server. The request cannot be processed.",
415: "The server does not support the media type transmitted in the request.", 415: "The server does not support the media type transmitted in the request.",
@ -328,6 +329,7 @@ ERROR_TITLES = {
405: "Method Not Allowed, BAD.", 405: "Method Not Allowed, BAD.",
406: "Too Many Pings fuck off", 406: "Too Many Pings fuck off",
409: "Cumflict", 409: "Cumflict",
410: "Gone... and Forgotten",
413: "Gayload Too Large", 413: "Gayload Too Large",
415: "Weird Media Type", 415: "Weird Media Type",
418: "I'm a teapot", 418: "I'm a teapot",
@ -343,6 +345,7 @@ ERROR_MSGS = {
405: "idk how anyone gets this error but if you see this, remember to follow @carpathianflorist<br>the original error text here talked about internet gremlins and wtf", 405: "idk how anyone gets this error but if you see this, remember to follow @carpathianflorist<br>the original error text here talked about internet gremlins and wtf",
406: "Max limit is 5 for comments and 50 for posts (what is it referring to? what does it mean? no one knows)", 406: "Max limit is 5 for comments and 50 for posts (what is it referring to? what does it mean? no one knows)",
409: "There's a conflict between what you're trying to do and what you or someone else has done and because of that you can't do what you're trying to do. So maybe like... don't try and do that? Sorry not sorry", 409: "There's a conflict between what you're trying to do and what you or someone else has done and because of that you can't do what you're trying to do. So maybe like... don't try and do that? Sorry not sorry",
410: "You were too slow. The link FUCKING DIED. Request a new one and be more efficient.",
413: "That's a heckin' chonker of a file! Please make it smaller or maybe like upload it somewhere else idk<BR>jc wrote this one hi jc!<br>- carp", 413: "That's a heckin' chonker of a file! Please make it smaller or maybe like upload it somewhere else idk<BR>jc wrote this one hi jc!<br>- carp",
415: "Please upload only Image, Video, or Audio files!", 415: "Please upload only Image, Video, or Audio files!",
418: "this really shouldn't happen now that we autoconvert webm files but if it does there's a cool teapot marsey so there's that", 418: "this really shouldn't happen now that we autoconvert webm files but if it does there's a cool teapot marsey so there's that",
@ -358,6 +361,7 @@ ERROR_MARSEYS = {
405: "marseyretard", 405: "marseyretard",
406: "marseyrage", 406: "marseyrage",
409: "marseynoyou", 409: "marseynoyou",
410: "marseyrave",
413: "marseychonker2", 413: "marseychonker2",
415: "marseydetective", 415: "marseydetective",
418: "marseytea", 418: "marseytea",
@ -568,6 +572,7 @@ elif SITE == 'watchpeopledie.tv':
ERROR_TITLES[405] = "Method Not Allowed" ERROR_TITLES[405] = "Method Not Allowed"
ERROR_TITLES[406] = "Too Many Pings" ERROR_TITLES[406] = "Too Many Pings"
ERROR_TITLES[409] = "Mortal Conflict" ERROR_TITLES[409] = "Mortal Conflict"
ERROR_TITLES[410] = "Dead"
ERROR_TITLES[413] = "Payload Too Large" ERROR_TITLES[413] = "Payload Too Large"
ERROR_TITLES[415] = "Unsupported Media Type" ERROR_TITLES[415] = "Unsupported Media Type"
ERROR_TITLES[500] = "Internal Server Error" ERROR_TITLES[500] = "Internal Server Error"
@ -577,6 +582,7 @@ elif SITE == 'watchpeopledie.tv':
ERROR_MSGS[404] = "That wasn't found" ERROR_MSGS[404] = "That wasn't found"
ERROR_MSGS[405] = "You can't use this method here... if you keep getting this error tell us it's prolly something borked" ERROR_MSGS[405] = "You can't use this method here... if you keep getting this error tell us it's prolly something borked"
ERROR_MSGS[409] = "There's a conflict between what you're trying to do and what you or someone else has done and because of that you can't do what you're trying to do." ERROR_MSGS[409] = "There's a conflict between what you're trying to do and what you or someone else has done and because of that you can't do what you're trying to do."
ERROR_MSGS[410] = "This link is dead. Request a new one to try again"
ERROR_MSGS[413] = "You need to upload a smaller file please" ERROR_MSGS[413] = "You need to upload a smaller file please"
ERROR_MSGS[429] = "Please wait a bit before doing that" ERROR_MSGS[429] = "Please wait a bit before doing that"

View File

@ -390,9 +390,7 @@ def get_reset():
now = int(time.time()) now = int(time.time())
if now - timestamp > 600: if now - timestamp > 600:
return render_template("message.html", abort(410, "This password reset link has expired.")
title="Password reset link expired",
error="This password reset link has expired.")
user = get_account(user_id) user = get_account(user_id)
@ -426,9 +424,7 @@ def post_reset(v):
now = int(time.time()) now = int(time.time())
if now - timestamp > 600: if now - timestamp > 600:
return render_template("message.html", abort(410, "This password reset link has expired.")
title="Password reset expired",
error="This password reset form has expired.")
user = get_account(user_id) user = get_account(user_id)
if not validate_hash(f"{user_id}+{timestamp}+reset+{user.login_nonce}", token): if not validate_hash(f"{user_id}+{timestamp}+reset+{user.login_nonce}", token):
@ -472,7 +468,7 @@ def request_2fa_disable():
email=request.values.get("email").strip().lower() email=request.values.get("email").strip().lower()
if not email_regex.fullmatch(email): if not email_regex.fullmatch(email):
return render_template("message.html", title="Invalid email.", error="Invalid email.") abort(400, "Invalid email")
password =request.values.get("password") password =request.values.get("password")
if not user.verifyPass(password): if not user.verifyPass(password):
@ -507,9 +503,7 @@ def reset_2fa():
abort(400) abort(400)
if now > t+3600*24: if now > t+3600*24:
return render_template("message.html", abort(410, "This 2FA reset link has expired.")
title="Expired Link",
error="This link has expired.")
token=request.values.get("token") token=request.values.get("token")
uid=request.values.get("id") uid=request.values.get("id")

View File

@ -23,15 +23,14 @@ def activate(v):
email = request.values.get("email", "").strip().lower() email = request.values.get("email", "").strip().lower()
if not email_regex.fullmatch(email): if not email_regex.fullmatch(email):
return render_template("message.html", v=v, title="Invalid email.", error="Invalid email."), 400 abort(400, "Invalid email")
id = request.values.get("id", "").strip() id = request.values.get("id", "").strip()
timestamp = int(request.values.get("time", "0")) timestamp = int(request.values.get("time", "0"))
token = request.values.get("token", "").strip() token = request.values.get("token", "").strip()
if int(time.time()) - timestamp > 3600: if int(time.time()) - timestamp > 3600:
return render_template("message.html", v=v, title="Verification link expired.", abort(410, "This email verification link has expired. Visit your settings to send yourself a new one.")
message="This link has expired. Visit your settings to send yourself another verification email."), 410
user = get_account(id) user = get_account(id)