forked from gergely/calendar-social
Log an audit message when a user logs out
This commit is contained in:
parent
23d0cd4b55
commit
12eb91d012
@ -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)
|
||||
|
||||
|
||||
@user_logged_out.connect
|
||||
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)
|
||||
|
Loading…
Reference in New Issue
Block a user