When a new AppUser is created, the CreatedDate is set to DateTimeOffset. UtcNow and the LastLoginDate
defaults to null. The UserService implements an UpdateAppUserLastLoginDateAsync function which is called
when the user successfully logs in. This function not only updates the LastLoginDate, but it also resets the
AccessFailedCount to 0.
Services > UserService:
public async Task<bool> UpdateAppUserLastLoginDateAsync(int appUserId)
var appUser = await TrackAppUserByIdAsync(appUserId).ConfigureAwait(false);
if (appUser == null) return false;
appUser.LastLoginDate = DateTimeOffset.UtcNow;
appUser.AccessFailedCount = 0;
return await UpdateAppUserAsync(appUser, appUser.RowVersion).ConfigureAwait(false);
The CreatedDate and the LastLoginDate are displayed on the user listing page and details modal
I enjoy writing these articles. It often enhances and clarifies my coding. I create research projects
to analyze and compose the articles before I publish them. The projects are the result of
a lot of refactoring and are provided with a MIT license. Registered users can download the
projects from Manage > Assets.