public ActionResult WriterRegister(WriterLoginDto writerLoginDto) { var response = Request["g-recaptcha-response"]; const string secret = "6LeNZ1cbAAAAAFlfrXzGA3GB0Ta0DZRXOChzLC_A"; var client = new WebClient(); var reply = client.DownloadString( string.Format("https://www.google.com/recaptcha/api/siteverify?secret={0}&response={1}", secret, response)); var captchaResponse = JsonConvert.DeserializeObject <CaptchaResult>(reply); if (captchaResponse.Success) { authService.WriterRegister( writerLoginDto.WriterName, writerLoginDto.WriterSurName, writerLoginDto.WriterUserName, writerLoginDto.WriterMail, writerLoginDto.WriterPassword ); return(RedirectToAction("MyContent", "WriterContent")); } return(View()); }
public ActionResult WriterRegister(WriterLoginDto writerLoginDto) { if (!this.IsCaptchaValid(errorText: "")) { ViewBag.ErrorMessage = "Doğrulama yanlış!"; return(View("WriterRegister", writerLoginDto)); } authService.WriterRegister(writerLoginDto.WriterMail, writerLoginDto.WriterPassword); return(RedirectToAction("WriterLogin", "Login")); }
public ActionResult WriterLogin(WriterLoginDto writerLoginDto) { if (authService.WriterLogin(writerLoginDto)) { FormsAuthentication.SetAuthCookie(writerLoginDto.WriterMail, false); Session["WriterMail"] = writerLoginDto.WriterMail; return(RedirectToAction("WriterProfile", "WriterPanel")); } else { ViewData["ErrorMessage"] = "Kullanıcı adı veya şifre yanlış"; return(View()); } }
public bool WriterLogin(WriterLoginDto writerLoginDto) { using (var hmac = new System.Security.Cryptography.HMACSHA512()) { var writer = _writerService.GetList(); foreach (var item in writer) { if (HashingHelper.WriterVerifyPasswordHash(writerLoginDto.WriterPassword, item.WriterPasswordHash, item.WriterPasswordSalt)) { return(true); } } return(false); } }
public ActionResult WriterRegister(WriterLoginDto writerLogin) { authService.WriterRegister ( writerLogin.WriterName, writerLogin.WriterSurname, writerLogin.WriterImage, writerLogin.WriterAbout, writerLogin.WriterMail, writerLogin.WriterPassword, writerLogin.Title, writerLogin.WriterStatus ); return(RedirectToAction("MyContent", "WriterPanelContent")); }
public ActionResult WriterLogin(WriterLoginDto writerLoginDto) { var response = Request["g-recaptcha-response"]; const string secret = "6LfbKk8bAAAAANkMjzLC_iAGX45a_J8RUWe1XYeQ"; var client = new WebClient(); var reply = client.DownloadString( string.Format("https://www.google.com/recaptcha/api/siteverify?secret={0}&response={1}", secret, response)); var captchaResponse = JsonConvert.DeserializeObject <CaptchaResult>(reply); if (authService.WriterLogin(writerLoginDto) && captchaResponse.Success) { FormsAuthentication.SetAuthCookie(writerLoginDto.WriterMail, false); Session["WriterMail"] = writerLoginDto.WriterMail; return(RedirectToAction("MyContent", "WriterPanelContent")); } else { ViewData["ErrorMessage"] = "Kullanıcı adı veya Parola yanlış"; return(RedirectToAction("WriterLogin")); } }
public ActionResult WriterLogin(WriterLoginDto writerLoginDto) { var response = Request["g-recaptcha-response"]; const string secret = "6Lfw6T8bAAAAAItuIShiVWQ5-4K-WhNS-m51WOtD"; var client = new WebClient(); var reply = client.DownloadString( string.Format("https://www.google.com/recaptcha/api/siteverify?secret={0}&response={1}", secret, response)); var captchaResponse = JsonConvert.DeserializeObject <CaptchaResult>(reply); if (authService.WriterLogin(writerLoginDto) && captchaResponse.Success) { var writerMail = writerManager.GetList().Where(x => x.WriterMail == writerLoginDto.WriterMail).FirstOrDefault(); if (writerMail != null) { bool result = HashingHelper.WriterVerifyPasswordHash(writerLoginDto.WriterPassword, writerMail.WriterPasswordHash, writerMail.WriterPasswordSalt); if (result == true) { FormsAuthentication.SetAuthCookie(writerLoginDto.WriterMail, false); Session["WriterEmail"] = writerLoginDto.WriterMail; return(RedirectToAction("MyContent", "WriterPanelContent")); } else { ViewData["ErrorMessage"] = "Kullanıcı adı veya Parola yanlış"; return(View()); } } } else { ViewData["ErrorMessage"] = "Kullanıcı adı veya Parola yanlış"; return(RedirectToAction("WriterLogin")); } return(View()); }
public ActionResult WriterRegister(WriterLoginDto writerLoginDto) { authService.WriterRegister(writerLoginDto.WriterEmail, writerLoginDto.WriterPassword); return(RedirectToAction("MyContent", "WriterPanelContent")); }