forked from rDrama/rDrama
integrate check_ban_evade into check_for_alts
parent
ba32ac8f3a
commit
d1bc2f3468
|
@ -832,23 +832,6 @@ class User(Base):
|
||||||
def is_suspended_permanently(self):
|
def is_suspended_permanently(self):
|
||||||
return (self.is_banned and self.unban_utc == 0)
|
return (self.is_banned and self.unban_utc == 0)
|
||||||
|
|
||||||
@lazy
|
|
||||||
def check_ban_evade(self):
|
|
||||||
for u in self.alts_unique:
|
|
||||||
if u.shadowbanned:
|
|
||||||
self.shadowbanned = u.shadowbanned
|
|
||||||
g.db.add(self)
|
|
||||||
g.db.commit()
|
|
||||||
return
|
|
||||||
## Disabled pending better solution: permabans haven't propagated for
|
|
||||||
## most of Summer 2022. We've gotten somewhat used to this. Think we only
|
|
||||||
## want them to propagate on account creation? Or at least needs discussion.
|
|
||||||
# if u.is_suspended_permanently:
|
|
||||||
# self.shadowbanned = u.banned_by.username
|
|
||||||
# g.db.add(self)
|
|
||||||
# g.db.commit()
|
|
||||||
# return
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@lazy
|
@lazy
|
||||||
def applications(self):
|
def applications(self):
|
||||||
|
|
|
@ -77,9 +77,7 @@ def get_logged_in_user():
|
||||||
|
|
||||||
g.v = v
|
g.v = v
|
||||||
|
|
||||||
if v:
|
if v: v.poor = session.get('poor')
|
||||||
v.poor = session.get('poor')
|
|
||||||
v.check_ban_evade()
|
|
||||||
|
|
||||||
if AEVANN_ID and request.headers.get("Cf-Ipcountry") == 'EG':
|
if AEVANN_ID and request.headers.get("Cf-Ipcountry") == 'EG':
|
||||||
if v and not v.username.startswith('Aev'):
|
if v and not v.username.startswith('Aev'):
|
||||||
|
|
|
@ -15,6 +15,7 @@ from files.classes import *
|
||||||
from flask import *
|
from flask import *
|
||||||
from files.__main__ import app, cache, limiter
|
from files.__main__ import app, cache, limiter
|
||||||
from .front import frontlist
|
from .front import frontlist
|
||||||
|
from .login import check_for_alts
|
||||||
from files.helpers.discord import add_role
|
from files.helpers.discord import add_role
|
||||||
import datetime
|
import datetime
|
||||||
import requests
|
import requests
|
||||||
|
@ -772,6 +773,10 @@ def admin_link_accounts(v):
|
||||||
)
|
)
|
||||||
|
|
||||||
g.db.add(new_alt)
|
g.db.add(new_alt)
|
||||||
|
g.db.flush()
|
||||||
|
|
||||||
|
check_for_alts(g.db.get(User, u1))
|
||||||
|
check_for_alts(g.db.get(User, u2))
|
||||||
|
|
||||||
ma = ModAction(
|
ma = ModAction(
|
||||||
kind="link_accounts",
|
kind="link_accounts",
|
||||||
|
|
|
@ -21,7 +21,8 @@ def login_get(v):
|
||||||
return render_template("login.html", failed=False, redirect=redir)
|
return render_template("login.html", failed=False, redirect=redir)
|
||||||
|
|
||||||
|
|
||||||
def check_for_alts(current_id):
|
def check_for_alts(current):
|
||||||
|
current_id = current.id
|
||||||
ids = [x[0] for x in g.db.query(User.id).all()]
|
ids = [x[0] for x in g.db.query(User.id).all()]
|
||||||
past_accs = set(session.get("history", []))
|
past_accs = set(session.get("history", []))
|
||||||
|
|
||||||
|
@ -78,6 +79,14 @@ def check_for_alts(current_id):
|
||||||
|
|
||||||
past_accs.add(current_id)
|
past_accs.add(current_id)
|
||||||
session["history"] = list(past_accs)
|
session["history"] = list(past_accs)
|
||||||
|
g.db.flush()
|
||||||
|
for u in current.alts_unique:
|
||||||
|
if u.shadowbanned:
|
||||||
|
current.shadowbanned = u.shadowbanned
|
||||||
|
g.db.add(current)
|
||||||
|
elif current.shadowbanned:
|
||||||
|
u.shadowbanned = current.shadowbanned
|
||||||
|
g.db.add(u)
|
||||||
|
|
||||||
|
|
||||||
@app.post("/login")
|
@app.post("/login")
|
||||||
|
@ -154,8 +163,7 @@ def on_login(account, redir=None):
|
||||||
session["lo_user"] = account.id
|
session["lo_user"] = account.id
|
||||||
session["login_nonce"] = account.login_nonce
|
session["login_nonce"] = account.login_nonce
|
||||||
if account.id == AEVANN_ID: session["verified"] = time.time()
|
if account.id == AEVANN_ID: session["verified"] = time.time()
|
||||||
|
check_for_alts(account)
|
||||||
check_for_alts(account.id)
|
|
||||||
|
|
||||||
@app.get("/me")
|
@app.get("/me")
|
||||||
@app.get("/@me")
|
@app.get("/@me")
|
||||||
|
@ -355,8 +363,7 @@ def sign_up_post(v):
|
||||||
send_verification_email(new_user)
|
send_verification_email(new_user)
|
||||||
|
|
||||||
|
|
||||||
check_for_alts(new_user.id)
|
check_for_alts(new_user)
|
||||||
new_user.check_ban_evade()
|
|
||||||
|
|
||||||
send_notification(new_user.id, WELCOME_MSG)
|
send_notification(new_user.id, WELCOME_MSG)
|
||||||
|
|
||||||
|
|
|
@ -19,6 +19,7 @@ import gevent
|
||||||
from sys import stdout
|
from sys import stdout
|
||||||
import os
|
import os
|
||||||
import json
|
import json
|
||||||
|
from .login import check_for_alts
|
||||||
|
|
||||||
def leaderboard_thread():
|
def leaderboard_thread():
|
||||||
db = db_session()
|
db = db_session()
|
||||||
|
@ -1332,6 +1333,7 @@ def fp(v, fp):
|
||||||
g.db.add(new_alt)
|
g.db.add(new_alt)
|
||||||
g.db.flush()
|
g.db.flush()
|
||||||
print(v.username + ' + ' + u.username, flush=True)
|
print(v.username + ' + ' + u.username, flush=True)
|
||||||
|
check_for_alts(v)
|
||||||
g.db.add(v)
|
g.db.add(v)
|
||||||
return '', 204
|
return '', 204
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue