Esempio n. 1
0
        public async Task <IActionResult> Deactivate(DeactivateViewModel model)
        {
            if (ModelState.IsValid)
            {
                var user = await _userManager.GetUserAsync(User);

                if (await _userManager.CheckPasswordAsync(user, model.Password))
                {
                    _repository.DeactivateUser(new Guid(user.Id));
                }
            }

            return(View(nameof(Deactivate)));
        }
Esempio n. 2
0
 public void UpdateUserFailedLogin(String userId)
 {
     try
     {
         GetGlobalSettings();
         var user = _applicationUserRepository.UpdateUserFailedLogin(userId);
         if (user.FailedLogInCount >= _globalSetting.MaxLogInAttempts)
         {
             _applicationUserRepository.DeactivateUser(userId);
         }
     }
     catch (Exception e)
     {
         throw new UnityException("Unable to update failed login count", e);
     }
 }