mirror of
https://gitlab.archlinux.org/archlinux/aurweb.git
synced 2025-02-03 10:43:03 +01:00
fix: remove sessions of suspended users
Fixes: #394 Signed-off-by: Leonidas Spyropoulos <artafinde@archlinux.org>
This commit is contained in:
parent
30e72d2db5
commit
0dddaeeb98
3 changed files with 80 additions and 8 deletions
|
@ -134,3 +134,19 @@ def password(
|
|||
# If the target user is the request user, login with
|
||||
# the updated password to update the Session record.
|
||||
user.login(request, P, cookies.timeout(remember_me))
|
||||
|
||||
|
||||
@db.retry_deadlock
|
||||
def suspend(
|
||||
S: bool = False,
|
||||
request: Request = None,
|
||||
user: models.User = None,
|
||||
context: dict[str, Any] = {},
|
||||
**kwargs,
|
||||
) -> None:
|
||||
if S and user.session:
|
||||
context["S"] = None
|
||||
with db.begin():
|
||||
db.delete_all(
|
||||
db.query(models.Session).filter(models.Session.UsersID == user.ID)
|
||||
)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue