fdsfs
This commit is contained in:
parent
6b7ae51d61
commit
dcbf6753e9
3 changed files with 12 additions and 12 deletions
|
@ -533,14 +533,6 @@ class User(Base):
|
||||||
g.db.add(self)
|
g.db.add(self)
|
||||||
|
|
||||||
|
|
||||||
def unban(self):
|
|
||||||
|
|
||||||
self.is_banned = 0
|
|
||||||
self.unban_utc = 0
|
|
||||||
|
|
||||||
g.db.add(self)
|
|
||||||
g.db.commit()
|
|
||||||
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@lazy
|
@lazy
|
||||||
|
|
|
@ -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()
|
users = g.db.query(User).options(lazyload('*')).options(lazyload('*')).filter_by(is_banned=user.id).all()
|
||||||
for user in users:
|
for user in users:
|
||||||
user.unban()
|
user.is_banned = 0
|
||||||
|
user.unban_utc = 0
|
||||||
|
g.db.add(user)
|
||||||
|
|
||||||
g.db.commit()
|
g.db.commit()
|
||||||
return {"message": "Admin actions reverted!"}
|
return {"message": "Admin actions reverted!"}
|
||||||
|
@ -936,12 +938,16 @@ def unban_user(user_id, v):
|
||||||
if not user:
|
if not user:
|
||||||
abort(400)
|
abort(400)
|
||||||
|
|
||||||
user.unban()
|
user.is_banned = 0
|
||||||
|
user.unban_utc = 0
|
||||||
|
g.db.add(user)
|
||||||
|
|
||||||
if request.values.get("alts", ""):
|
if request.values.get("alts", ""):
|
||||||
for x in user.alts:
|
for x in user.alts:
|
||||||
if x.admin_level == 0:
|
if x.admin_level == 0:
|
||||||
x.unban()
|
x.is_banned = 0
|
||||||
|
x.unban_utc = 0
|
||||||
|
g.db.add(x)
|
||||||
|
|
||||||
send_notification(NOTIFICATIONS_ACCOUNT, user,
|
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.")
|
"Your account has been reinstated. Please carefully review and abide by the [rules](/post/2510) to ensure that you don't get suspended again.")
|
||||||
|
|
|
@ -133,7 +133,9 @@ def login_post():
|
||||||
abort(400)
|
abort(400)
|
||||||
|
|
||||||
if account.is_banned and account.unban_utc > 0 and time.time() > account.unban_utc:
|
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
|
# set session and user id
|
||||||
session["user_id"] = account.id
|
session["user_id"] = account.id
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue