Ejemplo n.º 1
0
        //protected void btnPermisosUsuarioUpdate_Click(object sender, EventArgs e)
        //{
        //    unCliente = (UsuarioEntidad)Session["Cliente"];
        //    unCliente.Permisos.Clear();
        //    unCliente.Permisos.Add(new Familia());
        //    unCliente.Permisos[0].IdIFamPat = ddlPermisosUsuarioUpdate.SelectedIndex + 1;
        //    unManagerUsuarioFamilia.UsuarioUpdatePermisosFamilia(unCliente);
        //    cargarPermisos();
        //}

        protected void btnCambiarClave_Click(object sender, EventArgs e)
        {
            divEspacioModifClave.InnerHtml = "";
            divAlertaModifClave.Visible    = false;
            divMsjError.Visible            = false;
            StringBuilder sb = new StringBuilder();

            sb.Append("<br />");

            Page.Validate("ModifPass");
            if (Page.IsValid)
            {
                if (!string.IsNullOrWhiteSpace(txtClave.Value) && !string.IsNullOrWhiteSpace(txtClaveRep.Value) && txtClave.Value == txtClaveRep.Value)
                {
                    unCliente       = (UsuarioEntidad)Session["Cliente"];
                    unCliente.Clave = ServicioSecurizacion.AplicarHash(txtClave.Value);
                    unManagerUsuario.UpdateUsuarioContraseña(unCliente);
                    sb.Append("<br />");
                    divEspacioModifClave.InnerHtml = sb.ToString();
                    divAlertaModifClave.Visible    = true;
                }
                else
                {
                    divEspacioModifClave.InnerHtml = sb.ToString();
                    divAlertaModifClave.Visible    = false;
                    divMsjError.Visible            = true;
                }
            }
        }
Ejemplo n.º 2
0
        public static bool CambiarClave(string passVieja, string passNueva, string passRepetida)
        {
            var usuariosdad = new UsuarioCore();
            var Current     = HttpContext.Current;

            UsuarioEntidad usuarioentidadStatic = (UsuarioEntidad)Current.Session["Usuario"];

            var password = usuariosdad.Select(usuarioentidadStatic.CUIT, usuarioentidadStatic.NombreUsuario).Clave;

            passVieja    = TFI.SEGURIDAD.ServicioSecurizacion.AplicarHash(passVieja);
            passNueva    = TFI.SEGURIDAD.ServicioSecurizacion.AplicarHash(passNueva);
            passRepetida = TFI.SEGURIDAD.ServicioSecurizacion.AplicarHash(passRepetida);

            if (password == passVieja)
            {
                if (!string.IsNullOrWhiteSpace(passNueva) && !string.IsNullOrWhiteSpace(passRepetida) && passNueva == passRepetida)
                {
                    usuarioentidadStatic.Clave = passRepetida;
                    usuariosdad.UpdateUsuarioContraseña(usuarioentidadStatic);
                    return(true);
                }
            }
            return(false);
        }