Esempio n. 1
0
        public async Task <IActionResult> Cancel(string key)
        {
            var result = await userAccountService.HandleVerificationKeyAsync(key,
                                                                             VerificationKeyPurpose.ConfirmAccount);

            if (result.UserAccount == null || !result.PurposeValid || result.TokenExpired)
            {
                // TODO: clear token if account is there

                ModelState.AddModelError(IdentityBaseConstants.ErrorMessages.TokenIsInvalid);
                return(View("InvalidToken"));
            }

            var returnUrl = result.UserAccount.VerificationStorage;
            await userAccountService.ClearVerificationAsync(result.UserAccount);


            if (interaction.IsValidReturnUrl(returnUrl))
            {
                return(Redirect(Url.Action("Index", "Login", new { ReturnUrl = returnUrl })));
            }
            else
            {
                return(Redirect(returnUrl));
            }
        }