Beispiel #1
0
        public async Task ThenAUnlockUserViewModelOrchestratorResponseIsReturned()
        {
            //Arrange
            var unlockUserViewModel = new UnlockUserViewModel();

            //act
            var actual = await _accountOrchestrator.UnlockUser(unlockUserViewModel);

            //Assert
            Assert.IsAssignableFrom <OrchestratorResponse <UnlockUserViewModel> >(actual);
            Assert.IsTrue(actual.Data.Valid);
        }
Beispiel #2
0
        public async Task <ActionResult> Unlock(UnlockUserViewModel unlockUserViewModel)
        {
            if (string.IsNullOrWhiteSpace(unlockUserViewModel.ReturnUrl))
            {
                unlockUserViewModel.ReturnUrl = _owinWrapper.GetIdsReturnUrl();
            }

            var result = await _accountOrchestrator.UnlockUser(unlockUserViewModel);

            if (result.Data.Valid)
            {
                if (!string.IsNullOrEmpty(result.Data.ReturnUrl))
                {
                    TempData["AccountUnlocked"] = true;
                    return(new RedirectResult(result.Data.ReturnUrl));
                }
                return(await RedirectToEmployerPortal());
            }

            result.Data.UnlockCode       = string.Empty;
            result.Data.UnlockCodeLength = await GetUnlockCodeLength();

            return(View("Unlock", result));
        }