Implemented function to delete all active sessions of an user
This commit is contained in:
parent
23268f6557
commit
559c8c5c9c
|
@ -92,6 +92,16 @@ def get_users_sessions(user):
|
|||
return Session.query.filter(Session._user == user)
|
||||
|
||||
|
||||
def delete_sessions(user):
|
||||
"""Deletes all active sessions of a user
|
||||
|
||||
Args:
|
||||
user (User): User to delete all sessions for
|
||||
"""
|
||||
Session.query.filter(Session._user_id == user._id).delete()
|
||||
db.session.commit()
|
||||
|
||||
|
||||
def delete_session(token: Session):
|
||||
"""Deletes given Session
|
||||
|
||||
|
|
Loading…
Reference in New Issue