Orchard 1.9 Audit Trail/User's first logon

Topics: Customizing Orchard
May 14, 2015 at 1:16 AM
It seems to me that with the AuditTrail module I should be able to determine if a user has logged in before and how many times they have successfully logged in. I'm trying to set up Two-Factor Authentication but would like to test for the user's first login or even the first n logins to determine whether or not the user should be allowed to login without requiring a TFA code (thus giving them a chance to enroll in TFA). The IAuditTrailManager looks like a good place to start as it can be used to return records but it returns the records based on a page. How would I get all the records for a specific user as opposed to a specific page? Once I have the records for a user how would I filter for just the successful login attempts? Lastly is there a way I could tie this information into the User Content Item through a custom part so I can have a boolean member that would signify whether the user should be allowed with/without TFA? Thank you.