4 “Beloved, if our heart think not ill of us, we have confidence towards God:” — What means, “If our heart think not ill”? If it make true answer to us, that we love and that there is genuine love in us: not feigned but sincere; seeking a brother's salvation, expecting no emolument from a brother, but only his salvation— “we have confidence toward God: and whatsoever we ask, we shall receive of Him, because we keep His commandments.” — Therefore, not in the sight of men, but where God Himself sees, in the heart— “we have confidence,” then, “towards God: and whatsoever we ask, we shall receive of Him:” howbeit, because we keep His commandments.
What are “His commandments”? Must we be always repeating? “A new commandment give I unto you, that you love one another.” It is charity itself that he speaks of, it is this that he enforces. Whoso then shall have brotherly charity, and have it before God, where God sees, and his heart being interrogated under righteous examination make him none other answer than that the genuine root of charity is there for good fruits to come from; that man has confidence with God, and whatsoever he shall ask, he shall receive of Him, because he keeps His commandments.
Source: Homilies on the First Epistle of John (New Advent)