public JsonResult ResendOTP() { try { var XobjOTP = NewspaperSBTSession.OTP; XobjOTP.attemp += 1; TimeSpan ts = DateTime.Now - XobjOTP.OPTCreatedDate; if (ts.TotalMinutes > 10) { return(Json(shared.returnMessageJSON(Messages.OTPExpireDescription, "", true), JsonRequestBehavior.AllowGet)); } NewspaperSBTSession.OTP = null; BAL_Email Email = new BAL_Email(); PC_OTP objOTP = new PC_OTP(); objOTP.OPTP = bal.getOTP(); objOTP.OPTCreatedDate = DateTime.Now; NewspaperSBTSession.OTP = objOTP; PC_User xuser = new PC_User(); xuser.OTP = objOTP.OPTP; xuser.Email = NewspaperSBTSession.CurrentUser.Email; xuser.Fullname = NewspaperSBTSession.CurrentUser.Fullname; //for testing Email.GetEmailTemplate("OTP", xuser); } catch (Exception) { return(Json(shared.returnMessageJSON("System Error Try Again..", "", true), JsonRequestBehavior.AllowGet)); } return(Json(shared.returnMessageJSON(Messages.OTPResendSucceesDescription, "", false), JsonRequestBehavior.AllowGet)); }
//todo this method validate user ip details then trigger method for email otp public ActionResult UserRegion() { try { if (NewspaperSBTSession.OTP == null) { BAL_Email Email = new BAL_Email(); PC_OTP objOTP = new PC_OTP(); objOTP.OPTP = bal.getOTP(); objOTP.OPTCreatedDate = DateTime.Now; NewspaperSBTSession.OTP = objOTP; PC_User xuser = new PC_User(); xuser.OTP = objOTP.OPTP; xuser.Email = NewspaperSBTSession.CurrentUser.Email; xuser.Fullname = NewspaperSBTSession.CurrentUser.Fullname; //for testin Email.GetEmailTemplate("OTP", xuser); } } catch (Exception e) { shared.setReturnMessages("Login Failed", e.Message, true); return(RedirectToAction("Index", "Login")); } return(RedirectToAction("EmailOTP", "login")); // var user = NewspaperSBTSession.CurrentUser; // if (user == null) // { // return RedirectToAction("Index", "Login"); // } // var data= Utility.getuserRegiondetail(); //if (data.ip!="") { // var result= bal.getipdetails(data.city, data.ip,NewspaperSBTSession.CurrentUser.Userid); // if (result!=null) { // return RedirectToAction("EmailOTP", "login"); // } // else { // ViewBag.currentip = data.ip; // return View(); // } // } // return View(); }