public ActionResult Validate_Login(Technical_Analysis_Talking.Pro.App_Data.Users_ users) { Technical_Analysis_Talking.Pro.App_Data.Database_StructContainer database_ = new App_Data.Database_StructContainer(); App_Data.Users_ result = database_.Users_Set.FirstOrDefault((s) => (s.username == users.username && s.password == users.password)); /* * var response = Request["g-recaptcha-response"]; * string secretKey = "6LdeqcUUAAAAANvc_bhMz0Kf71Df5bc28SdIpWp6"; * var client = new WebClient(); * var result2 = client.DownloadString(string.Format("https://www.google.com/recaptcha/api/siteverify?secret={0}&response={1}", secretKey, response)); * var obj = Newtonsoft.Json.JsonConvert.DeserializeObject<CaptchaResponse>(result2); * var status = (bool)obj.Success; * ViewBag.Message = status ? "Google reCaptcha validation success" : "Google reCaptcha validation failed"; */ App_Data.Posts_[] posts = database_.Posts_Set.ToArray(); if (result != null) { if (result.username == users.username && result.password == users.password) { result.last_login_time = System.DateTime.Now.ToShortDateString(); database_.SaveChanges(); ViewData["loging_State"] = "true"; return(View("Admin_panel", posts.ToPagedList(1, 10))); } } return(View("login")); }
public ActionResult change_sec(Technical_Analysis_Talking.Pro.App_Data.Users_ users) { Technical_Analysis_Talking.Pro.App_Data.Database_StructContainer database_ = new App_Data.Database_StructContainer(); App_Data.Users_ result = database_.Users_Set.First(); result.username = users.username; result.password = users.password; database_.SaveChanges(); return(View("login")); }