Welcome Guest, Not a member yet? Register   Sign In
CommunityAuth Login/Logout Hooks/Functions
#1

I'm looking for the best way to implement the following...

I have CommunityAuth up and running, works great.

But I want to log/audit login/logout actions. I have a separate auditlog() function already written for this, but where is the best place call it from?

Inside the Auth_Model login_update() function for login?
Inside the Auth_Model logout() function for logout?

Thanks
Reply
#2

What exactly are you logging?
Reply
#3

On login: user_id, timestamp, IP address
On logout: user_id, timestamp
Reply
#4

Community Auth has a method in Auth_Controller called post_auth_hook, and so MY_Controller is a great place to extend that method and do what you want to do when they log in. Unfortunately, there is not yet a hook called at logout. This really wouldn't be hard to implement though. In the logout method of your controller that handles logout, simply check to see if the person is logged in before logging them out. This check provides you with an opportunity to log the details.
Reply




Theme © iAndrew 2016 - Forum software by © MyBB