Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
yii2
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
PSDI Army
yii2
Commits
2c30ddfc
Commit
2c30ddfc
authored
Oct 01, 2013
by
Carsten Brandt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added web\Controller::goBack() as shortcut
goBack() will redirect user to his returnUrl fixes #925
parent
d03d6815
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
1 deletion
+14
-1
SiteController.php
apps/basic/controllers/SiteController.php
+1
-1
Controller.php
framework/yii/web/Controller.php
+13
-0
No files found.
apps/basic/controllers/SiteController.php
View file @
2c30ddfc
...
...
@@ -61,7 +61,7 @@ class SiteController extends Controller
{
$model
=
new
LoginForm
();
if
(
$model
->
load
(
$_POST
)
&&
$model
->
login
())
{
return
$this
->
go
Home
();
return
$this
->
go
Back
();
}
else
{
return
$this
->
render
(
'login'
,
array
(
'model'
=>
$model
,
...
...
framework/yii/web/Controller.php
View file @
2c30ddfc
...
...
@@ -146,6 +146,19 @@ class Controller extends \yii\base\Controller
}
/**
* Redirects the browser to the last visited page.
* @param string|array $defaultUrl the default return URL in case it was not set previously.
* If this is null and the return URL was not set previously, [[Application::homeUrl]] will be redirected to.
* Please refer to [[User::setReturnUrl()]] on accepted format of the URL.
* @return Response the current response object
* @see User::getReturnUrl()
*/
public
function
goBack
(
$defaultUrl
=
null
)
{
return
Yii
::
$app
->
getResponse
()
->
redirect
(
Yii
::
$app
->
getUser
()
->
getReturnUrl
(
$defaultUrl
));
}
/**
* Refreshes the current page.
* This method is a shortcut to [[Response::refresh()]].
* @param string $anchor the anchor that should be appended to the redirection URL.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment