master
Aevann1 2021-09-19 22:18:29 +02:00
parent 886fff86b5
commit ec3021704c
3 changed files with 12 additions and 12 deletions

View File

@ -533,14 +533,6 @@ class User(Base):
g.db.add(self)
def unban(self):
self.is_banned = 0
self.unban_utc = 0
g.db.add(self)
g.db.commit()
@property
@lazy

View File

@ -39,7 +39,9 @@ def revert_actions(v, username):
users = g.db.query(User).options(lazyload('*')).options(lazyload('*')).filter_by(is_banned=user.id).all()
for user in users:
user.unban()
user.is_banned = 0
user.unban_utc = 0
g.db.add(user)
g.db.commit()
return {"message": "Admin actions reverted!"}
@ -936,12 +938,16 @@ def unban_user(user_id, v):
if not user:
abort(400)
user.unban()
user.is_banned = 0
user.unban_utc = 0
g.db.add(user)
if request.values.get("alts", ""):
for x in user.alts:
if x.admin_level == 0:
x.unban()
x.is_banned = 0
x.unban_utc = 0
g.db.add(x)
send_notification(NOTIFICATIONS_ACCOUNT, user,
"Your account has been reinstated. Please carefully review and abide by the [rules](/post/2510) to ensure that you don't get suspended again.")

View File

@ -133,7 +133,9 @@ def login_post():
abort(400)
if account.is_banned and account.unban_utc > 0 and time.time() > account.unban_utc:
account.unban()
account.is_banned = 0
account.unban_utc = 0
g.db.add(account)
# set session and user id
session["user_id"] = account.id