Beispiel #1
0
        private bool ValidateUser2(string userName)
        {
            string[] lookUser = null;
            try
            {
                BrUser brUser = new BrUser();

                lookUser = brUser.getName(userName).Split('¬');

                // Si no se encuentra la contraseña, devuelve false.
                if (null == lookUser)
                {
                    // Para más seguridad, puede escribir aquí los intentos de inicio de sesión con error para el registro de eventos.
                    return(false);
                }

                // Comparar lookupPassword e introduzca passWord, usando una comparación que distinga mayúsculas y minúsculas.
                return(0 == string.Compare(lookUser[1], userName, false));
            }
            catch (Exception ex)
            {
                // Agregar aquí un control de errores para la depuración.
                // Este mensaje de error no debería reenviarse al que realiza la llamada.
                System.Diagnostics.Trace.WriteLine("[ValidateUser] Exception " + ex.Message);
                return(false);
            }
        }
Beispiel #2
0
        protected void btnReferido_Click(object sender, EventArgs e)
        {
            bool respuesta2 = false;

            respuesta2 = this.ValidateUser2(txtReferido.Text.Trim());

            if (respuesta2)
            {
                BrUser obrUser = new BrUser();

                if (txtReferido.Text != "")
                {
                    string names = obrUser.getName(txtReferido.Text);
                    Session["Referido"] = txtReferido.Text;
                    Session["auxRef"]   = "1";
                    if (names != "ERROR")
                    {
                        FormsAuthentication.RedirectFromLoginPage(names + "¬referido", chkPersistCookie.Checked);
                    }
                }
            }
            else
            {
                Response.Redirect("Index.aspx?Key=" + userName, true);
            }
        }
Beispiel #3
0
        protected void btnLogin_Click(object sender, EventArgs e)/*MERGE*/
        {
            bool respuesta = false;
            //string respuesta2 = "";
            string user = "", pass = "";

            user = txtUsuario.Text.Trim();
            pass = txtPassword.Text.Trim();
            Session["Discount"] = 0;
            if (string.IsNullOrEmpty(user) || string.IsNullOrEmpty(pass))
            {
                return;
            }
            respuesta = this.ValidateUser(user, pass);
            BrUser obrUser = new BrUser();

            if (respuesta)
            {
                //    /*4 idasociado*/
                string name = obrUser.getName(txtUsuario.Text);
                Response.Cookies["Key"].Value = name;
                FormsAuthentication.RedirectFromLoginPage(name, chkPersistCookie.Checked);
            }
        }
Beispiel #4
0
        protected void btnSaveDataPerson_Click(object sender, EventArgs e)
        {
            string userName = "", name = "", lastName = "", birthday = "", email = "", phone1 = "", phone2 = "", country = "", estado = "", city = "", adress = "";

            string[] arrayLogin = HttpContext.Current.User.Identity.Name.Split('¬');
            string   data = "", sexo = "M";

            if (rbWoman.Checked)
            {
                sexo = "F";
            }

            userName = arrayLogin[1];
            name     = txtName.Text.Trim();
            lastName = txtLastName.Text.Trim();
            birthday = txtBirthday.Text.Trim().Replace('/', '-');
            email    = txtEmail.Text.Trim();
            phone1   = txtPhone.Text.Trim();
            phone2   = txtPhone2.Text.Trim();
            country  = txtCountry.Text.Trim();

            city   = txtCiudad.Text.Trim();
            adress = txtAddress.Text.Trim();
            estado = Estadop.Text.Trim();

            Validation vali = new Validation();

            if (!vali.IsString(name))
            {
                txtName.Focus();
                lblMesaggePer.Text = "El Nombre no es Valido";
                return;
            }
            if (!vali.IsString(lastName))
            {
                txtLastName.Focus();
                lblMesaggePer.Text = "El Apellido no es valido";
                return;
            }
            string[] arrayBirthDay = birthday.Split('-');
            if (arrayBirthDay.Length < 3)
            {
                txtBirthday.Focus();
                lblMesaggePer.Text = "La Fecha No tiene Formato Completo";

                return;
            }
            if (arrayBirthDay[0].Length != 2 || arrayBirthDay[1].Length != 2 || arrayBirthDay[2].Length != 4)
            {
                txtBirthday.Focus();
                lblMesaggePer.Text = "La Fecha No tiene Formato Completo";
                return;
            }
            if (!vali.IsEmail(email))
            {
                txtEmail.Focus();
                lblMesaggePer.Text = "No es una Email Valido";
                return;
            }
            //if (!vali.IsPhone(phone1))
            //{
            //    txtPhone.Focus();
            //    lblMesaggePer.Text = "Telefono 1 No es Valido";
            //    return;
            //}
            //if (!string.IsNullOrEmpty(phone2))
            //{
            //    if (!vali.IsPhone(phone2))
            //    {
            //        txtPhone2.Focus();
            //        lblMesaggePer.Text = "Telefono 2 No es Valido";
            //        return;
            //    }
            //}
            if (!vali.IsString(country))
            {
                txtCountry.Focus();
                lblMesaggePer.Text = "No es Una Pais Valido";
                return;
            }
            if (!vali.IsString(estado))
            {
                Estadop.Focus();
                lblMesaggePer.Text = "No es Una Estado Valido";
                return;
            }
            if (!vali.IsString(city))
            {
                txtCiudad.Focus();
                lblMesaggePer.Text = "No es Una Ciudad Valida";
                return;
            }
            data = userName + "|" +
                   name + "|" +
                   lastName + "|" +
                   birthday + "|" +
                   sexo + "|" +
                   email + "|" +
                   phone1 + "|" +
                   phone2 + "|" +
                   country + "|" +
                   estado + "|" +
                   city + "|" +
                   adress;
            BrUser brUser = new BrUser();
            bool   anwser = brUser.PutPersonalInformation(data);

            if (anwser)
            {
                string nameLogin = brUser.getName(arrayLogin[1]);
                FormsAuthentication.RedirectFromLoginPage(nameLogin, true);
                Response.Redirect("Edit.aspx", true);
            }
            lblMesaggePer.Text = "Ha Ocurrido un Error";
        }