forked from rDrama/rDrama
wpd: remove special front page logic
parent
add8c27182
commit
8506c46306
|
@ -16,31 +16,6 @@ from files.__main__ import app, cache, limiter
|
||||||
@limiter.limit("3/second;30/minute;5000/hour;10000/day")
|
@limiter.limit("3/second;30/minute;5000/hour;10000/day")
|
||||||
@auth_desired_with_logingate
|
@auth_desired_with_logingate
|
||||||
def front_all(v, sub=None, subdomain=None):
|
def front_all(v, sub=None, subdomain=None):
|
||||||
#### WPD TEMP #### special front logic
|
|
||||||
from datetime import datetime
|
|
||||||
|
|
||||||
from files.helpers.security import generate_hash, validate_hash
|
|
||||||
now = datetime.utcnow()
|
|
||||||
if SITE == 'watchpeopledie.co':
|
|
||||||
if v and not v.admin_level and not v.id <= 9: # security: don't auto login admins or bots
|
|
||||||
hash = generate_hash(f'{v.id}+{now.year}+{now.month}+{now.day}+{now.hour}+WPDusermigration')
|
|
||||||
return redirect(f'https://watchpeopledie.tv/?user={v.id}&code={hash}', 301)
|
|
||||||
else:
|
|
||||||
return redirect('https://watchpeopledie.tv/', 301)
|
|
||||||
elif SITE == 'watchpeopledie.tv' and not v: # security: don't try to login people into accounts more than once
|
|
||||||
req_user = request.values.get('user')
|
|
||||||
req_code = request.values.get('code')
|
|
||||||
if req_user and req_code:
|
|
||||||
from files.routes.login import on_login
|
|
||||||
user = get_account(req_user, graceful=True)
|
|
||||||
if user:
|
|
||||||
if user.admin_level or user.id <= 9:
|
|
||||||
abort(401)
|
|
||||||
else:
|
|
||||||
if validate_hash(f'{user.id}+{now.year}+{now.month}+{now.day}+{now.hour}+WPDusermigration', req_code):
|
|
||||||
on_login(user)
|
|
||||||
return redirect('/')
|
|
||||||
#### WPD TEMP #### end special front logic
|
|
||||||
if sub:
|
if sub:
|
||||||
sub = get_sub_by_name(sub, graceful=True)
|
sub = get_sub_by_name(sub, graceful=True)
|
||||||
if sub and not User.can_see(v, sub): abort(403, "You need 5000 truescore to be able to see /h/chudrama")
|
if sub and not User.can_see(v, sub): abort(403, "You need 5000 truescore to be able to see /h/chudrama")
|
||||||
|
|
Loading…
Reference in New Issue