Log an audit message when a user logs out

This commit is contained in:
Gergely Polonkai 2018-07-08 22:52:40 +02:00
parent 23d0cd4b55
commit 12eb91d012
1 changed files with 11 additions and 1 deletions

View File

@ -18,7 +18,7 @@
from flask import current_app
from flask_login.signals import user_logged_in
from flask_login.signals import user_logged_in, user_logged_out
from flask_security import Security, AnonymousUser as BaseAnonymousUser
security = Security()
@ -44,3 +44,13 @@ def login_handler(app, user):
from .models import AuditLog
AuditLog.log(user, AuditLog.TYPE_LOGIN_SUCCESS)
def logout_handler(app, user):
"""Signal handler to be called when a user logs out
from .models import AuditLog
AuditLog.log(user, AuditLog.TYPE_LOGOUT)