Exemple #1
0
    public void btnConfirmar_Click(object sender, EventArgs e)
    {
        UsuarioBC usuario = (UsuarioBC)Session["Usuario"];

        llenarUsuario(usuario);

        if (txtPass.Text == "" || txtNuevaPass.Text == "" || txtConfirmaPass.Text == "")
        {
            ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "mensaje", "alert('Ingrese todos los campos');", true);
        }

        else if (usuario.PASSWORD != funcion.Encriptar(txtPass.Text, usuario.USERNAME))
        {
            ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "mensaje", "alert('Password actual no es valida');", true);
        }

        else if ((txtNuevaPass.Text) != (txtConfirmaPass.Text))
        {
            ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "mensaje", "alert('Password no coinciden');", true);
        }
        else
        {
            usuario.CambioPass(usuario);
            ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "mensaje", "showAlert('Password Actualizada');", true);
            ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "mensaje2", "$('#modalConfirmaciopass').modal('hide');", true);
        }
    }