Using Sitecore 10.1.2
I would like to log the CMS user information like username, email, and logged-in timestamp as soon as a user logs into the CMS.
The details would be captured in a custom table with some business logic.
We have both native CMS & Azure AD accounts.
Could you please suggest the method, processor or pipeline where I can add my custom logic?
Update:
Following the suggestion, I have implemented this.
These are the existing settings from ShowConfig.aspx
.
My patch config:
<?xml version="1.0"?>
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
<sitecore>
<pipelines>
<processors>
<loggedin argsType="Sitecore.Pipelines.LoggedIn.LoggedInArgs">
<processor mode="on" type="MyProject.Foundation.Accounts.CMS.CmsLoginAudit.SaveAuditLog, MyProject.Foundation.Accounts" resolve="true"/>
</loggedin>
</processors>
</pipelines>
</sitecore>
</configuration>
And the class:
namespace MyProject.Foundation.Accounts.CMS
{
public class CmsLoginAudit
{
public void SaveAuditLog()
{
if (Context.IsLoggedIn)
{
User user = Context.User;
MembershipUser membershipUser = Membership.GetUser(user.Name);
var userId = membershipUser?.ProviderUserKey;
var userIp = GetUserIpAddress();
string userEmail = membershipUser.Email;
}
}
}
}
The ShowConfig.aspx
does include the the patch config settings.
But the debugger isn't hitting the SaveAuditLog
method.
What am I missing here.