Quantcast
Channel: Live News for Yii Framework
Viewing all articles
Browse latest Browse all 2941

[Wiki] Disable login page if user is logged in

$
0
0

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.


Viewing all articles
Browse latest Browse all 2941

Trending Articles