public ActionResult VerifySecret() { VerifySecrete model = new VerifySecrete(); ViewBag.CaptchaGuid = Guid.NewGuid().ToString("N"); if ("".Equals(SessionKeyMgmt.SecreteQuestion) || SessionKeyMgmt.SecreteQuestion == null) { ModelState.AddModelError("", "Your request is invalid, sorry we cant process it!"); SessionKeyMgmt.SecreteQuestion = ""; return View(model); } ViewBag.SecQ = SessionKeyMgmt.SecreteQuestion; return View(model); }
public ActionResult VerifySecret(VerifySecrete secretModel) { ViewBag.SecQ = SessionKeyMgmt.SecreteQuestion; if (ModelState.IsValid) { if (SessionKeyMgmt.UserId != null && !"".Equals(SessionKeyMgmt.UserId)) { if (verifyCaptcha() == false) { return View(secretModel); } var allusers = from usertabel in database.DX_USER where usertabel.userid == SessionKeyMgmt.UserId select usertabel; if (allusers != null && allusers.ToList().Count == 1) { DX_USER user = allusers.ToList().First(); if (secretModel.Answer != null && !"".Equals(secretModel.Answer) && generateHash(secretModel.Answer.ToLower()).Equals(user.anshash)) { if (sendNotificationCode()) { return RedirectToAction("EnterActivationCode", "Account"); } else { ModelState.AddModelError("", "Problem in sending notificatoin code please try recovering the password later!"); return RedirectToAction("LogOn", "Account"); } } else { ModelState.AddModelError("", "Your request is invalid, sorry we cant process it!"); return View(secretModel); } } else { ModelState.AddModelError("", "Your request is invalid, sorry we cant process it!"); return View(secretModel); } } } return View(secretModel); }