This is a very simple tutorial that demonstrates how to redirect user back to the returnUrl if he is already logged in.
This works with the default Yii authentication system: Open protected/controllers/SiteController.php and after:
public function actionLogin() {
add this code:
if (Yii::app()->user->getId() !== null) { $this->redirect(Yii::app()->user->returnUrl); }
Save the file, and you are done.