Пример #1
0
        public async Task <ActionResult> ConfirmEmail()
        {
            int    userId  = AccountUtils.GetUserIdFromRequest(Request);
            string code    = AccountUtils.GetCodeFromRequest(Request);
            bool   success = false;

            if (userId != 0 && !String.IsNullOrEmpty(code))
            {
                var result = await OwinUserManager.ConfirmEmailAsync(userId, code);

                success = result.Succeeded;
            }
            if (success && Request.IsAuthenticated)
            {
                return(Redirect(Url.Action("Edit", "Account", null, "https") + "#/logins"));
            }
            else
            {
                // If the user comes to the Login page authenticated, she gets redirected further to the login management page.
                OwinAuthenticationManager.SignOut(DefaultAuthenticationTypes.ApplicationCookie);
                return(Redirect(Url.Action("Login", "Account", new { confirmed = success }, "https")));
            }
        }