God longs to give us grace, so that we might live in triumph at all times. But He can give grace only to the humble. And often He finds that He can humble us only through allowing us to fall into gross sin. That is not the best way. Jesus was humble, without ever falling into sin. But Peter and David and many other men of God have not been able to manage it, as well as Jesus did. But the wonderful thing is that God uses even Peters and Davids who have failed miserably. But only when they weep bitterly in repentance over their failures - not otherwise.
The first-century writer of "The Epistle of Barnabas" says, "When the Lord chose His apostles who were to proclaim His gospel, He chose those who were the greatest sinners of all, so that He might show that He came not to call the righteous but sinners to repentance."
What God did for Peter and David, He will do for you too.
Stop complaining then that it was because Eve gave you the fruit to eat, or that it was because John asked the doorkeeper to let you into the courtyard that you sinned. Take the blame yourself. It was certainly not the will of God that you should sin and fail. But now that you have failed, God can make even that work for His glory and for your good - to make you a broken man, so that you will never again be hard on others for the rest of your life. So praise the Lord. Overcome Satan then by the blood of the Lamb and by the word of your testimony. Speak the word of faith, and be a broken man, like Peter and David, for the rest of your days.
God planned our lives even before we were born. David says, "You saw me before I was born and scheduled each day of my life before I began to breathe. Every day was recorded in your Book. How precious it is, Lord, to realize that you are thinking about me constantly! I can't even count how many times a day your thoughts turn towards me. And when I waken in the morning, you are still thinking of me!" (Psa. 139:16-18 - Living).
That means that God has a diary in heaven for you with your name on the cover. That diary records what His plan for your life is - for every single day. Centuries before you were born, He had already written down who you parents were going to be, and which country you would be born into, and the circumstances that He would arrange to bring you to Christ. It is also written in that diary what trials He would take you through in order to give you a spiritual education. And also how He would make your blunders to work for His glory. All you have to do now is to ask God to show you each day what is recorded in that diary for you. Tell Him that you want to do His will on earth as it is done in heaven, since you can never make a better plan for your life than the one that God has already made for you.
Praise the Lord for such a wonderful Father that we have in heaven and for such a wonderful gospel by which Satan is crushed under our feet, and his accusations against us nullified completely.