"What
 is considered a perfect act of repentance? When one is faced with the 
same opportunity to repeat the original transgression, but now he does 
not do it because he has repented... however, when one does not repeat 
the original transgression, [and refrains from sinning] because now he 
fears people will find out... his repentance is still accepted, but it 
is not considered a perfect repentance"  
To explain a perfect scenario of Teshuba, Maimonides gives the example of a man who is involved in an adulterous relationship and later on repents. The ultimate test of his repentance would take place if that man is eventually faced with a similar opportunity but now he refrains from repeating the transgression, because he repented, and because he has reached a new understanding: now he realizes that following his material impulses will hurt him, driving him away from God.
However,
 if that man faces a similar scenario but now he refrains from sinning 
because he fears somebody will find out about his affair, his Teshuba is
 still acceptable, but it is not considered a complete Teshuba. Why? 
Because this man might have changed his conduct not because of his 
repentance and his renewed understanding, but just because of social 
embarrassment, fear of losing his job, etc.
A
 modern example:  Very often we read in the news about a public figure, 
usually someone involved in politics, who was caught doing an immoral 
act. Many times these people would come in front of the TV cameras and 
publicly express their regret and apologize for what they have 
done. This is definitely an act of repentance. However, because of its 
timing, this act of Teshuba is questionable in terms of its credibility 
and genuineness. Why? Because the whole process of repentance, regret 
and apologies happened as a consequence of being caught. It is possible 
that what prompts this person to repent is his fear to loss his  
reputation, his job, his family etc., rather than his moral 
conscience.     
Following
 Maimonides words, the perfect act of repentance in this case would have
 taken place if, while still involved in an illicit relationship or 
other immoral act, before being caught and with no external impediment 
to continue with it, one would decide out of his own conscience, to 
stop, repent and change. 
That would be a perfect a and complete Teshuba