What I did was added a new field to the User Settings and saved it off there vs. session. Made for a more robust solution. The event handler documentation for v7 can be found here.
Here is my code sample in the ClassLoaderModule.cs file:
[MyCustomClassLoaderModule]
public partial class CMSModuleLoader
{
/// <summary>
/// Summary description for MyCustomClassLoaderModuleAttribute
/// </summary>
public class MyCustomClassLoaderModuleAttribute : CMSLoaderAttribute
{
private UserInfo lastUserInfo;
/// <summary>
/// Initializes the module
/// </summary>
public override void Init()
{
SecurityEvents.Authenticate.Execute += Authenticate_Execute;
}
/// <summary>
/// On authenticate, update the users last login date info
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void Authenticate_Execute(object sender, AuthenticationEventArgs e)
{
if (e.User != null)
{
UserInfo ui = e.User;
UserSettingsInfo usi = UserSettingsInfoProvider.GetUserSettingsInfoByUser(ui.UserID);
if (ui.LastLogon != DateTime.MinValue)
{
usi.SetValue("UserLastAccountActivity", ui.LastLogon);
UserSettingsInfoProvider.SetUserSettingsInfo(usi);
}
}
}
}
}