/// <summary> /// Generates the OTP. /// </summary> /// <remarks></remarks> private string GenerateOTP() { string code = string.Empty; try { if (hdnOTP.Value == string.Empty) { string MobileNum = ViewState["Mobile_Num"].ToString(); string EmailId = Convert.ToString(ViewState["Email_ID"]); if (!string.IsNullOrEmpty(OverRideMobile)) { MobileNum = OverRideMobile; } if (!string.IsNullOrEmpty(OverRideEmail)) { EmailId = OverRideEmail; } txtOTP.Text = ""; OTPClient otp = new OTPClient(); long CardHolderId = CardHolderManager.GetLoggedInUser().CardHolder_Id; code = otp.SendRequest(MobileNum, EmailId, Constants.ForgotPwd, CardHolderId); hdnOTP.Value = code; } } catch (Exception ex) { LabelOTPErrorMessage.Text = Constants.TechnicalError; DivOTPErrorMessage.Attributes.CssStyle.Add("display", "block"); string path = Server.MapPath("~/ErrorPage/ErrorLog"); GeneralMethods.ErrorLog(path, ex); return("0"); } return(code); }
public async Task TestGetAll() { using (var client = new OTPClient()) { var routers=await client.Routers.GetAllAsync(); Assert.AreEqual(1, routers.Length); Assert.AreEqual("EastGermany",routers[0].Id); Assert.IsTrue(routers[0].Polygon!=null); Assert.IsTrue(routers[0].BuildTime!=null); } }
public async Task TestGetAll() { using (var client = new OTPClient()) { var routers = await client.Routers.GetAllAsync(); Assert.AreEqual(1, routers.Length); Assert.AreEqual("EastGermany", routers[0].Id); Assert.IsTrue(routers[0].Polygon != null); Assert.IsTrue(routers[0].BuildTime != null); } }
/// <summary> /// Generates the OTP. /// </summary> /// <remarks></remarks> private string GenerateOTP() { string code = string.Empty; try { string MobileNum = ""; if (hdnOTP.Value == string.Empty) { if (ViewState["Mobile_Num"] != null) { MobileNum = ViewState["Mobile_Num"].ToString(); } string EmailId = Convert.ToString(ViewState["Email_ID"]); if (!string.IsNullOrEmpty(OverRideMobile)) { MobileNum = OverRideMobile; } if (!string.IsNullOrEmpty(OverRideEmail)) { EmailId = OverRideEmail; } txtOTP.Text = ""; OTPClient otp = new OTPClient(); long CardHolderId = CardHolderManager.GetLoggedInUser().CardHolder_Id; code = otp.SendRequest(MobileNum, EmailId, Constants.ForgotUName, CardHolderId); hdnOTP.Value = code; //Start Added by abhijeet on 09/10/2019 to restrict 3 OTP in one session, VAPT issue if (Session["OTP_Frg_User"] != null && Session["OTP_Frg_User"].ToString() != "") { int cnt = 0; if (Int32.TryParse(Session["OTP_Frg_User"].ToString(), out cnt)) { Session["OTP_Frg_User"] = cnt + 1; } } else { Session["OTP_Frg_User"] = "******"; } ViewState["LastOTPSent"] = DateTime.Now; //End Added by abhijeet on 09/10/2019 to restrict 3 OTP in one session VAPT, issue } } catch (Exception) { LblErrorMessage.Text = Constants.TechnicalError; DivERROR.Attributes.CssStyle.Add("display", "block"); return("0"); } return(code); }
/// <summary> /// Generates the OTP. /// </summary> /// <remarks></remarks> private string GenerateOTP() { string code = string.Empty; try { if (hdnOTP.Value == string.Empty) { string MobileNum = ViewState["Mobile_Num"].ToString(); string EmailId = Convert.ToString(ViewState["Email_ID"]); if (!string.IsNullOrEmpty(OverRideMobile)) { MobileNum = OverRideMobile; } if (!string.IsNullOrEmpty(OverRideEmail)) { EmailId = OverRideEmail; } txtOTP.Text = ""; OTPClient otp = new OTPClient(); long CardHolderId = CardHolderManager.GetLoggedInUser().CardHolder_Id; code = otp.SendRequest(MobileNum, EmailId, Constants.ForgotPwd, CardHolderId); hdnOTP.Value = code; //Start Added by abhijeet on 09/10/2019 to restrict 3 OTP in one session, VAPT issue if (Session["OTP_Frg_User"] != null && Session["OTP_Frg_User"].ToString() != "") { int cnt = 0; if (Int32.TryParse(Session["OTP_Frg_User"].ToString(), out cnt)) { Session["OTP_Frg_User"] = cnt + 1; } } else { Session["OTP_Frg_User"] = "******"; } ViewState["LastOTPSent"] = DateTime.Now; //End Added by abhijeet on 09/10/2019 to restrict 3 OTP in one session VAPT, issue } } catch (Exception ex) { lblStep1Message.Text = Constants.TechnicalError; string path = Server.MapPath("~/ErrorPage/ErrorLog"); GeneralMethods.ErrorLog(path, ex); return("0"); } return(code); }
public async Task TestPlan() { using (var client = new OTPClient()) { var plan = await client.Planner.Plan(new PlanRequest { FromPlace = new GeoCoordinate(52.599535278374645, 13.290302753448486), ToPlace = new GeoCoordinate(52.58200889177419, 13.358602523803711), Mode = "CAR" }); Assert.AreEqual("Titusweg", plan.Plan.From.Name); Assert.AreEqual("NORMAL", plan.Plan.From.VertexType); Assert.AreEqual("Markscheiderstraße", plan.Plan.To.Name); Assert.AreEqual("NORMAL", plan.Plan.To.VertexType); Assert.IsTrue(plan.Plan.From.Coordinate.Latitude > 50); Assert.IsTrue(plan.Plan.From.Coordinate.Longitude > 13); Assert.AreEqual(1,plan.Plan.Itineraries[0].Legs.Length); var geometry = plan.Plan.Itineraries[0].Legs[0].Geometry.GetPoints().ToArray(); Assert.IsTrue(geometry.All(p=>p.Latitude>50&&p.Longitude>13)); } }
public async Task TestPlan() { using (var client = new OTPClient()) { var plan = await client.Planner.Plan(new PlanRequest { FromPlace = new GeoCoordinate(52.599535278374645, 13.290302753448486), ToPlace = new GeoCoordinate(52.58200889177419, 13.358602523803711), Mode = "CAR" }); Assert.AreEqual("Titusweg", plan.Plan.From.Name); Assert.AreEqual("NORMAL", plan.Plan.From.VertexType); Assert.AreEqual("Markscheiderstraße", plan.Plan.To.Name); Assert.AreEqual("NORMAL", plan.Plan.To.VertexType); Assert.IsTrue(plan.Plan.From.Coordinate.Latitude > 50); Assert.IsTrue(plan.Plan.From.Coordinate.Longitude > 13); Assert.AreEqual(1, plan.Plan.Itineraries[0].Legs.Length); var geometry = plan.Plan.Itineraries[0].Legs[0].Geometry.GetPoints().ToArray(); Assert.IsTrue(geometry.All(p => p.Latitude > 50 && p.Longitude > 13)); } }
/// <summary> /// Handles the Click event of the btnProceed control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param> /// <remarks></remarks> protected void btnProceed_Click(object sender, EventArgs e) { try { if (cmpConfirmPassowrd.IsValid && cmpNewPassord.IsValid && reqConfirmPassword.IsValid && reqNewPassword.IsValid && reqOldPassword.IsValid) { string OldPwd = txtOldPassword.Text.Trim(); string dbPassword = Session.GetUserPassword(); //if (txtOldPassword.Text.Trim().Encrypt() == Session.GetUserPassword()) if (String.CompareOrdinal(OldPwd, dbPassword) == 0) { if (hdnOTP.Value == string.Empty) { OTPClient otp = new OTPClient(); string mobilenum = Session.GetMobileNum(); if (!string.IsNullOrEmpty(OverRideMobile)) { mobilenum = OverRideMobile; } string code = otp.SendRequest(mobilenum, "", Constants.ModifyPwd, CardHolderManager.GetLoggedInUser().CardHolder_Id); // Temporary Commented will added in future mvPasswordChange.ActiveViewIndex = 1; StartOTPTimer(); hdnOTP.Value = code; //txtOTP.Text = code; //for testing remove later string lastFourdgts = string.Empty; if (mobilenum != "") { int numberkength = mobilenum.Length; if (numberkength > 4) { lastFourdgts = mobilenum.Substring(numberkength - 4, 4); } else { lastFourdgts = mobilenum; } txtMobileNo.Text = mobilenum; ViewState["Mobile_Num"] = mobilenum; } //mobilenum = mobilenum.Substring(6, 4); //lblDescOTP.Text = Constants.OTPDescforchangePwd; //lblmob.Text = "(i.e. XXXXXX" + lastFourdgts + ")"; //lbl3.Text = Constants.OTPDesc2; } ViewState["ModifyPassword"] = txtNewPassword.Text.Trim(); } else { lblMessage.Text = Constants.IncorrectOldPwd; DivMessage.Attributes.CssStyle.Add("display", "block"); } } } catch (Exception exp) { LblErrorMessage.Text = Constants.TechnicalError; DivERROR.Attributes.CssStyle.Add("display", "block"); } }
public static string SendOTP(string UserName) { //divPassword.Attributes.CssStyle.Add("display", "none"); // divOTP.Attributes.CssStyle.Add("display", "block"); // divIncorrectOTP.Attributes.CssStyle.Add("display", "flex"); // divOTPSent.Attributes.CssStyle.Add("display", "block"); // rfvPwd.Enabled = false; // rfvOTP.Enabled = true; string MobileNumber = string.Empty; string EmailId = string.Empty; string publicIp = HttpContext.Current.Request.UserHostAddress; CardHolderManager chm = new CardHolderManager(); var cardHolder = chm.AuthenticateUser(UserName, publicIp); if (cardHolder != null) { CardManager cm = new CardManager(); CH_CardDTO card = cm.GetCardByCreditCardNumber(new CH_CardDTO() { Cr_Account_Nbr = cardHolder.creditcard_acc_number.Decrypt() }); if (card != null) { MobileNumber = hideMobileNumber = card.PHONE_MOBILE; EmailId = hideEmailId = card.EMAIL_ID; } } string MobileNum = ""; string OtpSuccess = string.Empty; string jsonresult = string.Empty; string OverRideEmail = ConfigurationManager.AppSettings["OverRideUserEmail"]; string OverRideMobile = ConfigurationManager.AppSettings["OverRideUserMobile"]; MobileNum = MobileNumber.Substring(0, 6); strMobile = MobileNum.Replace(MobileNum, "xxxxxx") + MobileNumber.Substring(MobileNumber.Length - 4); try { if (OtpSuccess == null || OtpSuccess == string.Empty) { if (!string.IsNullOrEmpty(OverRideMobile)) { MobileNum = OverRideMobile; } if (!string.IsNullOrEmpty(ConfigurationManager.AppSettings["OverRideUserEmail"])) { EmailId = ConfigurationManager.AppSettings["OverRideUserEmail"]; } OTPClient otp = new OTPClient(); long CardHolderId = CardHolderManager.GetLoggedInUser().CardHolder_Id; OtpSuccess = otp.SendOTPRequest(MobileNumber, EmailId, Constants.ForgotUName, CardHolderId); OTPval = OtpSuccess; if (OtpSuccess != "0" && !string.IsNullOrEmpty(OtpSuccess)) { int strsec = 20; jsonresult = OtpSuccess + "," + strMobile + "," + strsec; } } } catch (Exception ex) { } return(jsonresult); }
public static string SendOTP(string CardNumber, string MobileNumber, string EmailId) { string MobileNum = ""; string OtpSuccess = string.Empty; string jsonresult = string.Empty; string OverRideEmail = ConfigurationManager.AppSettings["OverRideUserEmail"]; string OverRideMobile = ConfigurationManager.AppSettings["OverRideUserMobile"]; MobileNum = MobileNumber.Substring(0, 6); string strMobile = MobileNum.Replace(MobileNum, "xxxxxx") + MobileNumber.Substring(MobileNumber.Length - 4); //Start Added by abhijeet on 09/10/2019 to restrict 3 OTP in one session with 20 sec wait time VAPT issue if (HttpContext.Current.Session["OTP_Count"] != null && HttpContext.Current.Session["OTP_Count"].ToString() != "") { int cnt = 0; if (Int32.TryParse(HttpContext.Current.Session["OTP_Count"].ToString(), out cnt) && cnt >= 3) { return(jsonresult = Constants.MaxNoOfOTPMessage + ","); } } if (LastOTPSent != null && LastOTPSent.ToString() != "") { DateTime d; if (DateTime.TryParse(LastOTPSent.ToString(), out d)) { TimeSpan difference = DateTime.Now.Subtract(d); if (difference.TotalSeconds < 20) { return(jsonresult = Constants.MaxNoOfOTPMessageForTime + ","); } else { jsonresult = ""; } } } //End Added by abhijeet on 09/10/2019 to restrict 3 OTP in one session VAPT issue try { if (OtpSuccess == null || OtpSuccess == string.Empty) { if (!string.IsNullOrEmpty(OverRideMobile)) { MobileNum = OverRideMobile; } if (!string.IsNullOrEmpty(ConfigurationManager.AppSettings["OverRideUserEmail"])) { EmailId = ConfigurationManager.AppSettings["OverRideUserEmail"]; } OTPClient otp = new OTPClient(); long CardHolderId = CardHolderManager.GetLoggedInUser().CardHolder_Id; OtpSuccess = otp.SendOTPRequest(MobileNumber, EmailId, Constants.ForgotUName, CardHolderId); OTPval = OtpSuccess; //Start Added by abhijeet on 09/10/2019 to restrict 3 OTP in one session, VAPT issue if (HttpContext.Current.Session["OTP_Count"] != null && HttpContext.Current.Session["OTP_Count"].ToString() != "") { int cnt = 0; if (Int32.TryParse(HttpContext.Current.Session["OTP_Count"].ToString(), out cnt)) { HttpContext.Current.Session["OTP_Count"] = cnt + 1; } } else { HttpContext.Current.Session["OTP_Count"] = "1"; } LastOTPSent = DateTime.Now; //End Added by abhijeet on 09/10/2019 to restrict 3 OTP in one session VAPT, issue if (OtpSuccess != "0" && !string.IsNullOrEmpty(OtpSuccess)) { int strsec = 20; jsonresult = OtpSuccess + "," + strMobile + "," + strsec; } } } catch (Exception ex) { } return(jsonresult); }