forked from gergely/calendar-social
Log an audit message when a user successfully logs in
This commit is contained in:
parent
aede5873d2
commit
23d0cd4b55
@ -18,6 +18,7 @@
|
||||
"""
|
||||
|
||||
from flask import current_app
|
||||
from flask_login.signals import user_logged_in
|
||||
from flask_security import Security, AnonymousUser as BaseAnonymousUser
|
||||
|
||||
security = Security()
|
||||
@ -33,3 +34,13 @@ class AnonymousUser(BaseAnonymousUser):
|
||||
"""
|
||||
|
||||
return current_app.timezone
|
||||
|
||||
|
||||
@user_logged_in.connect
|
||||
def login_handler(app, user):
|
||||
"""Signal handler to be called when a user successfully logs in
|
||||
"""
|
||||
|
||||
from .models import AuditLog
|
||||
|
||||
AuditLog.log(user, AuditLog.TYPE_LOGIN_SUCCESS)
|
||||
|
Loading…
Reference in New Issue
Block a user