remotes/1693045480750635534/spooky-22
Aevann1 2021-10-21 20:06:57 +02:00
parent 3eb17619b6
commit 21a4298394
5 changed files with 8 additions and 2 deletions

View File

@ -452,6 +452,7 @@ class User(Base):
if self.unban_utc and self.unban_utc < time.time():
self.is_banned = 0
self.unban_utc = 0
self.ban_evade = 0
g.db.add(self)
g.db.commit()
return (self.is_banned and (not self.unban_utc or self.unban_utc > time.time()))

View File

@ -43,8 +43,7 @@ def get_logged_in_user():
def check_ban_evade(v):
if not v or not v.ban_evade or v.admin_level > 0:
return
if not v or not v.ban_evade or v.admin_level > 0 or v.is_suspended: return
if random.randint(0,30) < v.ban_evade:
v.ban(reason="permaban evasion")

View File

@ -46,6 +46,7 @@ def revert_actions(v, username):
for user in users:
user.is_banned = 0
user.unban_utc = 0
user.ban_evade = 0
g.db.add(user)
g.db.commit()
@ -910,6 +911,7 @@ def unban_user(user_id, v):
user.is_banned = 0
user.unban_utc = 0
user.ban_evade = 0
g.db.add(user)
if request.values.get("alts", ""):
@ -917,6 +919,7 @@ def unban_user(user_id, v):
if x.admin_level == 0:
x.is_banned = 0
x.unban_utc = 0
x.ban_evade = 0
g.db.add(x)
send_notification(NOTIFICATIONS_ACCOUNT, user,

View File

@ -398,6 +398,7 @@ def award_post(pid, v):
else:
author.unban_utc = 0
author.is_banned = 0
author.ban_evade = 0
send_notification(NOTIFICATIONS_ACCOUNT, author, f"You have been unbanned!")
elif kind == "grass":
author.is_banned = AUTOJANNY_ACCOUNT
@ -501,6 +502,7 @@ def award_comment(cid, v):
else:
author.unban_utc = 0
author.is_banned = 0
author.ban_evade = 0
send_notification(NOTIFICATIONS_ACCOUNT, author, f"You have been unbanned!")
elif kind == "grass":
author.is_banned = AUTOJANNY_ACCOUNT

View File

@ -136,6 +136,7 @@ def login_post():
if account.is_banned and account.unban_utc > 0 and time.time() > account.unban_utc:
account.is_banned = 0
account.unban_utc = 0
account.ban_evade = 0
g.db.add(account)
session["user_id"] = account.id