Rework error system a bit to remove a bunch of duplicated code (#434)

This commit is contained in:
justcool393 2022-12-01 18:58:27 -08:00 committed by GitHub
parent 08602b4279
commit 0c632d73b7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
28 changed files with 197 additions and 350 deletions

View file

@ -179,7 +179,7 @@ def logout(v):
@auth_desired
def sign_up_get(v):
if not app.config['SETTINGS']['Signups']:
return {"error": "New account registration is currently closed. Please come back later."}, 403
abort(403, "New account registration is currently closed. Please come back later.")
if v: return redirect(SITE_FULL)
@ -225,7 +225,7 @@ def sign_up_get(v):
@auth_desired
def sign_up_post(v):
if not app.config['SETTINGS']['Signups']:
return {"error": "New account registration is currently closed. Please come back later."}, 403
abort(403, "New account registration is currently closed. Please come back later.")
if v: abort(403)
@ -254,7 +254,6 @@ def sign_up_post(v):
username = username.strip()
def signup_error(error):
args = {"error": error}
if request.values.get("referred_by"):
user = g.db.query(User).filter_by(id=request.values.get("referred_by")).one_or_none()