Esempio n. 1
0
        public async Task <ActionResult> ConfirmEmail(string userId, string code)
        {
            if (userId == null || code == null)
            {
                return(View("Error"));
            }

            var result = await UserManager.ConfirmEmailAsync(userId, code);

            if (!result.Succeeded)
            {
                PortalErrorInfo portalErrorInfo = PortalErrorInfo.CreateNew("El codigo de confirmacion no es correcto o ah expirado.");
                return(View("Error", portalErrorInfo));
            }
            return(View(result.Succeeded ? "ConfirmEmail" : "Error"));
        }
Esempio n. 2
0
        public async Task <ActionResult> VerifyCode(string provider, string returnUrl)
        {
            // Require that the user has already logged in via username/password or external login
            if (!await SignInManager.HasBeenVerifiedAsync())
            {
                PortalErrorInfo portalErrorInfo = PortalErrorInfo.CreateNew(" Require that the user has already logged in via username/password or external login");
                return(View("Error", portalErrorInfo));
            }
            var user = await UserManager.FindByIdAsync(await SignInManager.GetVerifiedUserIdAsync());

            if (user != null)
            {
                ViewBag.Status = "For DEMO purposes the current " + provider + " code is: " + await UserManager.GenerateTwoFactorTokenAsync(user.Id, provider);
            }
            return(View(new VerifyCodeViewModel {
                Provider = provider, ReturnUrl = returnUrl
            }));
        }