forked from MarseyWorld/MarseyWorld
disable signups when ddos detected
parent
73bb8f6153
commit
6bf8f67d0f
|
@ -48,7 +48,8 @@ def error_401(e):
|
||||||
qs = urlencode(dict(request.values))
|
qs = urlencode(dict(request.values))
|
||||||
argval = quote(f"{path}?{qs}", safe='').replace('/logged_out','')
|
argval = quote(f"{path}?{qs}", safe='').replace('/logged_out','')
|
||||||
if not argval: argval = '/'
|
if not argval: argval = '/'
|
||||||
if session.get("history") or not get_setting("signups"): return redirect(f"/login?redirect={argval}")
|
if session.get("history") or not get_setting("signups") or get_setting("ddos_detected"):
|
||||||
|
return redirect(f"/login?redirect={argval}")
|
||||||
else: return redirect(f"/signup?redirect={argval}")
|
else: return redirect(f"/signup?redirect={argval}")
|
||||||
|
|
||||||
@app.errorhandler(500)
|
@app.errorhandler(500)
|
||||||
|
|
|
@ -146,7 +146,7 @@ def logout(v):
|
||||||
@limiter.limit(DEFAULT_RATELIMIT, deduct_when=lambda response: response.status_code < 400)
|
@limiter.limit(DEFAULT_RATELIMIT, deduct_when=lambda response: response.status_code < 400)
|
||||||
@auth_desired
|
@auth_desired
|
||||||
def sign_up_get(v):
|
def sign_up_get(v):
|
||||||
if not get_setting('signups'):
|
if not get_setting('signups') or get_setting("ddos_detected"):
|
||||||
abort(403, "New account registration is currently closed. Please come back later!")
|
abort(403, "New account registration is currently closed. Please come back later!")
|
||||||
|
|
||||||
if v: return redirect(SITE_FULL)
|
if v: return redirect(SITE_FULL)
|
||||||
|
@ -195,7 +195,7 @@ def sign_up_get(v):
|
||||||
@limiter.limit("10/day", deduct_when=lambda response: response.status_code < 400)
|
@limiter.limit("10/day", deduct_when=lambda response: response.status_code < 400)
|
||||||
@auth_desired
|
@auth_desired
|
||||||
def sign_up_post(v):
|
def sign_up_post(v):
|
||||||
if not get_setting('signups'):
|
if not get_setting('signups') or get_setting("ddos_detected"):
|
||||||
abort(403, "New account registration is currently closed. Please come back later!")
|
abort(403, "New account registration is currently closed. Please come back later!")
|
||||||
|
|
||||||
if v: abort(403)
|
if v: abort(403)
|
||||||
|
|
Loading…
Reference in New Issue