Пример #1
0
        public async Task<IActionResult> Authenticate(AuthenticateViewModel model, string returnUrl = null)
        {
            var token = Request.Cookies[DeveloperAuthHandler.StateCookie];
            var data = DeveloperAuthOptions.StateDataFormat.Unprotect(token);
            using (MD5 md5Hash = MD5.Create())
            {
                string hash = GetMd5Hash(md5Hash, model.LoginModel.Email);
                if (VerifyMd5Hash(md5Hash, model.LoginModel.Email, hash))
                {
                    var autoPost = new AutoPostModel {URI = data.CallBackUri};
                    autoPost.FormDictionary.Add("_email",model.LoginModel.Email);
                    autoPost.FormDictionary.Add("_userId", hash);
                    return View("AutoPost",autoPost);
//                    return Redirect(data.CallBackUri);
                }
            }

            return View();
        }
        public async Task <IActionResult> Authenticate(AuthenticateViewModel model, string returnUrl = null)
        {
            var token = Request.Cookies[DeveloperAuthHandler.StateCookie];
            var data  = DeveloperAuthOptions.StateDataFormat.Unprotect(token);

            using (MD5 md5Hash = MD5.Create())
            {
                string hash = GetMd5Hash(md5Hash, model.LoginModel.Email);
                if (VerifyMd5Hash(md5Hash, model.LoginModel.Email, hash))
                {
                    var autoPost = new AutoPostModel {
                        URI = data.CallBackUri
                    };
                    autoPost.FormDictionary.Add("_email", model.LoginModel.Email);
                    autoPost.FormDictionary.Add("_userId", hash);
                    return(View("AutoPost", autoPost));
//                    return Redirect(data.CallBackUri);
                }
            }

            return(View());
        }