예제 #1
0
        protected virtual async Task SaveLoginAttempt(AbpLoginResult <TTenant, TUser> 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 UserLoginAttempt
                    {
                        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,
                    };

                    await UserLoginAttemptRepository.InsertAsync(loginAttempt);

                    await UnitOfWorkManager.Current.SaveChangesAsync();

                    await uow.CompleteAsync();
                }
            }
        }
예제 #2
0
        protected virtual async Task SaveLoginAttempt(SmdLoginResult <TUser> loginResult, string userNameOrEmailAddress)
        {
            var loginAttempt = new UserLoginAttempt
            {
                UserId = loginResult.User != null ? loginResult.User.Id : (long?)null,
                UserNameOrEmailAddress = userNameOrEmailAddress,

                Result = loginResult.Result,

                BrowserInfo     = ClientInfoProvider.BrowserInfo,
                ClientIpAddress = ClientInfoProvider.ClientIpAddress,
                ClientName      = ClientInfoProvider.ComputerName,
            };

            await UserLoginAttemptRepository.InsertAsync(loginAttempt);
        }
예제 #3
0
        protected virtual async Task SaveLoginAttempt(LoginResult <TUser> loginResult, string userNameOrEmailAddress)
        {
            var loginAttempt = new UserLoginAttempt
            {
                UserId = loginResult.User != null ? loginResult.User.Id : (long?)null,
                UserNameOrEmailAddress = userNameOrEmailAddress,

                Result = loginResult.Result,

                BrowserInfo     = ClientInfoProvider.BrowserInfo,
                ClientIpAddress = ClientInfoProvider.ClientIpAddress,
                ClientName      = ClientInfoProvider.ComputerName,
            };

            await UserLoginAttemptRepository.InsertAsync(loginAttempt);

            _repositoryContext.Commit();
            //await UnitOfWorkManager.Current.SaveChangesAsync();

            //await uow.CompleteAsync();
        }