@support - Thank you for the code sample via email.
I have successfully written the constant string "test..." to my new column ClientInfo in AbpUserLoginAttempts table.
protected override async Task SaveLoginAttemptAsync(AbpLoginResult<Tenant, User> loginResult, string tenancyName, string userNameOrEmailAddress)
{
using (var uow = UnitOfWorkManager.Begin(TransactionScopeOption.Suppress))
{
var tenantId = loginResult.Tenant != null ? loginResult.Tenant.Id : (int?)null;
using (UnitOfWorkManager.Current.SetTenantId(tenantId))
{
var loginAttempt = new TtmUserLoginAttempt
{
TenantId = tenantId,
TenancyName = tenancyName,
UserId = loginResult.User != null ? loginResult.User.Id : (long?)null,
UserNameOrEmailAddress = userNameOrEmailAddress,
Result = loginResult.Result,
BrowserInfo = ClientInfoProvider.BrowserInfo,
ClientIpAddress = ClientInfoProvider.ClientIpAddress,
ClientName = ClientInfoProvider.ComputerName,
ClientInfo = "test..."
};
await _myUserLoginAttemptRepository.InsertAsync(loginAttempt);
await UnitOfWorkManager.Current.SaveChangesAsync();
await uow.CompleteAsync();
}
}
}
The only question remaining is how to replace the constant "test..." string with my client data?
Getting client data to the server via TokenAuthController.Authenticate(...) is easily done.
The signature of SaveLoginAttemptAsync can't be changed.
ANZ app doesn't call SaveLoginAttemptAsync directly, so adding a parameter would be useless anyway.
The my string can't be piggybacked with an existing parameter.
The LogInManager
class is instantiated in Abp library, not by ANZ app. So, no adding parameters there either.
Sorry if this sounds like a dumb question that any decent C# programmer could answer. I don't see any mechanism that would allow the string presented during authentication to be available in SaveLoginAttemptAsync.
@troyfernando - building is a disk-intensive process. Upgrading from HDD to SSD made all the difference for me.
Try adding the [string] to *.xml localization dictionaries in .Core/Localization
npm start 15% building 47/69 modules 22 active ... build time under 2 minutes.
My build time improved significantly after upgrading to i7 CPU, SSD, and faster SRAM.
When did "similar issues reported by other developers" become a criteria for responding to a support request?
@ryancyq - I don't understand how to do what you're suggesing. Specifically, how is a user-defined string added to the correct row in the table? Could you please provide more detailed information? To summarize, I want to add a custom string that originates on the client (at login) in a new column in AbpUserLoginAtttempts table.
@ryancyq - Thank you for your comment and directing me to the source code :)
It seems my only choices are:
LogInManager.LoginAsync
method with an additional optional argument (i.e. string OptionalUserDefined = string.Empty
). This technique would allow a developer to define literally any structure encoded as a JSON string, inhibit update/create access to the table, and not affect existing implementations.To use any table "normally" one must know which Id (row) to update. Which row should my code update for the logged-in user?
I have been unable to find any code that writes to this table. Could you please direct me to a file which does this?
The only examples I can find are retrieving all AbpUserLoginAtttempts in bulk form.
I read the document.
How would I identify the logged-in user's record in AbpUserLoginAtttempts table? How would I determine the Id to select for?
Yes. And I still don't know the cause. It seems inconceivable that this bug only manifests when Microsoft announces the release of a new version of Visual Studio. Could you suggest some other cause?