Difference between #1 and #2 of
Adding login form to each page

Revision #2 has been created by pestaa on Aug 23, 2009, 9:10:53 AM with the memo:

Make use of $app
« previous (#1) next (#3) »

Changes

Title unchanged

Adding login form to each page

Category unchanged

Tutorials

Yii version unchanged

Tags unchanged

Content changed

[...]
```php
$app=Yii::app();
if($app->createUrl($app->user->loginUrl[0])!=$app->request->getUrl())
$app->user->setReturnUrl(
Yii::$app()->request->getUrl());
```

The above code does the following: if the user is at the login page, the referrer is not saved for future reference (otherwise he will be redirected to the login page right after he logged in, which is, of course, not the desired effect).

In any other cases, the previously viewed page is reloaded if the user logs in with the form in the header.
[...]
3 1
7 followers
Viewed: 49 444 times
Version: 1.1
Category: Tutorials
Written by: pestaa
Last updated by: Yang He
Created on: Aug 23, 2009
Last updated: 11 years ago
Update Article

Revisions

View all history