rename the over_18 cookie key in a last ditch attempt to relieve the duplicate cookie victims of infinite +18 warnings
parent
e9590775f6
commit
cd942c18a2
|
@ -47,7 +47,7 @@ def post_pid_comment_cid(cid, pid=None, anything=None, v=None, sub=None):
|
||||||
|
|
||||||
post = get_post(post, v=v)
|
post = get_post(post, v=v)
|
||||||
|
|
||||||
if post.over_18 and not (v and v.over_18) and not session.get('over_18', 0) >= int(time.time()):
|
if post.over_18 and not (v and v.over_18) and not session.get('over_18_cookies', 0) >= int(time.time()):
|
||||||
if v and v.client: abort(403, "This content is not suitable for some users and situations!")
|
if v and v.client: abort(403, "This content is not suitable for some users and situations!")
|
||||||
else: return render_template("errors/nsfw.html", v=v), 403
|
else: return render_template("errors/nsfw.html", v=v), 403
|
||||||
|
|
||||||
|
|
|
@ -65,7 +65,7 @@ def error_500(e):
|
||||||
@limiter.limit('1/second', scope=rpath)
|
@limiter.limit('1/second', scope=rpath)
|
||||||
@limiter.limit(DEFAULT_RATELIMIT)
|
@limiter.limit(DEFAULT_RATELIMIT)
|
||||||
def allow_nsfw():
|
def allow_nsfw():
|
||||||
session["over_18"] = int(time.time()) + 3600
|
session["over_18_cookies"] = int(time.time()) + 3600
|
||||||
redir = request.values.get("redir", "/")
|
redir = request.values.get("redir", "/")
|
||||||
if is_site_url(redir): return redirect(redir)
|
if is_site_url(redir): return redirect(redir)
|
||||||
return redirect('/')
|
return redirect('/')
|
||||||
|
|
|
@ -89,7 +89,7 @@ def post_id(pid, anything=None, v=None, sub=None):
|
||||||
p = get_post(pid, v=v)
|
p = get_post(pid, v=v)
|
||||||
if not User.can_see(v, p): abort(403)
|
if not User.can_see(v, p): abort(403)
|
||||||
|
|
||||||
if p.over_18 and not (v and v.over_18) and session.get('over_18', 0) < int(time.time()):
|
if p.over_18 and not (v and v.over_18) and session.get('over_18_cookies', 0) < int(time.time()):
|
||||||
if g.is_api_or_xhr: abort(451, "Must be 18+ to view")
|
if g.is_api_or_xhr: abort(451, "Must be 18+ to view")
|
||||||
return render_template("errors/nsfw.html", v=v)
|
return render_template("errors/nsfw.html", v=v)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue