protected void Button_Send_Pass_Click(object sender, EventArgs e) { MyError.Text = ""; txtUid.Text = Safety.SafeSql(txtUid.Text); TextBox_Email.Text = Safety.SafeSql(TextBox_Email.Text); // check if there is code if (txtUid.Text.Length < 8) { xalert("Please enter Organcode"); TextBox_numberSendPass.Text = ""; return; } // check if there is email if (TextBox_Email.Text.Length == 0) { xalert("Please enter correct Email"); TextBox_numberSendPass.Text = ""; return; } // check if email is valid Regex regex = new Regex(@"^([\w\.\-]+)@([\w\-]+)((\.(\w){2,3})+)$"); Match match = regex.Match(TextBox_Email.Text); if (!match.Success) { xalert("Please enter correct Email"); TextBox_numberSendPass.Text = TextBox_Email.Text = ""; return; } //چک کردن کد امنیتی string number_server_side = (string)Session[ADSSAntiBot.SESSION_CAPTCHA]; TextBox_numberSendPass.Text = Safety.SafeSql(TextBox_numberSendPass.Text); number_server_side = Encryption.EncryptEngine.RawEncrypt(number_server_side, "AcS5Cf"); if (number_server_side != Encryption.EncryptEngine.RawEncrypt(TextBox_numberSendPass.Text, "AcS5Cf")) { TextBox_numberSendPass.Text = ""; Label_invalidSendPass.Visible = true; return; } else { // check if there is exist same code and email and cheked string ret = DataAccessFactory.CreateOrganInsuredData(). GetOrganEmail(Convert.ToInt32(txtUid.Text)); if (ret == "0") { xalert("چنین دستگاهی با این آدرس پست الکترونیکی شناسایی نشد ."); TextBox_numberSendPass.Text = TextBox_Email.Text = ""; return; } else if (ret == "") { xalert("پست الکترونیکی دستگاه در سامانه ثبت نگردیده است ."); TextBox_numberSendPass.Text = TextBox_Email.Text = ""; return; } } }
protected void SignInBt_Click(object sender, EventArgs e) { if (Page.IsValid) { string number_server_side = (string)Session[ADSSAntiBot.SESSION_CAPTCHA]; TextBox_number.Text = Safety.SafeSql(TextBox_number.Text); number_server_side = Encryption.EncryptEngine.RawEncrypt(number_server_side, "AcS5Cf"); if (number_server_side != Encryption.EncryptEngine.RawEncrypt(TextBox_number.Text, "AcS5Cf")) { Label_invalid.Visible = true; TextBox_number.Text = ""; return; } else { SignInUser.Text = SignInUser.Text.Replace("'", "''"); SignInPass.Text = SignInPass.Text.Replace("'", "''").Trim(); //--------------------------- CHECK FOR EMPTY PASSWORD if (SignInPass.Text.Length == 0) { lblMessage.Text = "Please enter your password"; TextBox_number.Text = ""; return; } else { lblMessage.Text = ""; } //------------------------------------------------------ int tmp; bool useridIsNumeric = int.TryParse(SignInUser.Text, out tmp); if (useridIsNumeric && (SignInUser.Text.Length == 7 || SignInUser.Text.Length == 5 || SignInUser.Text.Length == 1)) { SignInUser.Text = "0" + SignInUser.Text; } if (useridIsNumeric && SignInUser.Text.Length == 8) // check for devices { string xpass = DataAccessFactory.CreateOrganInsuredData() .GetOrganLoginData(Convert.ToInt32(SignInUser.Text)); if (SignInUser.Text + SignInPass.Text != xpass) { lblMessage.Text = "Incorrect Username or password"; TextBox_number.Text = ""; return; } HttpContext.Current.Session.Clear(); SessionHelper.Karbar = 0; SessionHelper.Dastgah.Refresh(int.Parse(SignInUser.Text)); Response.Redirect("~/InsuredAgentOrg/Default.aspx", false); return; } } if (SignInPass.Text.Length == 0) { return; } } }