Skip to content

Commit

Permalink
Merge pull request #11 from JamesAlias/3.0
Browse files Browse the repository at this point in the history
TASK: Add 'toOriginalRequest' option to redirect:afterLogin setting
  • Loading branch information
JamesAlias authored Jan 10, 2017
2 parents db3dd4c + ae288fa commit 672a202
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,15 @@ class FlowRedirectTargetService implements RedirectTargetServiceInterface
*/
public function onAuthenticationSuccess(ControllerContext $controllerContext, ActionRequest $originalRequest = null)
{
if (is_array($this->redirectAfterLogin)
&& array_key_exists('toOriginalRequest', $this->redirectAfterLogin)
&& $this->redirectAfterLogin['toOriginalRequest'] === true
&& $originalRequest !== null
) {
// If an original request is stored, redirect there!
return $originalRequest;
}

if (is_array($this->redirectAfterLogin)
&& array_key_exists('action', $this->redirectAfterLogin)
&& array_key_exists('controller', $this->redirectAfterLogin)
Expand Down
4 changes: 3 additions & 1 deletion Configuration/Settings.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,10 @@ Sandstorm:
redirect:
afterLogin: []
afterLogout: []
# To activate redirection, make these settings. controllerArguments are optional.
# To activate redirection, make these settings. controllerArguments are optional. For "afterLogin", either "action / controller / package" or
# "toOriginalRequest" are mandatory.
# afterLogin:
# toOriginalRequest: false # set to TRUE if you want to redirect to the original request.
# action: 'action'
# controller: 'Controller'
# package: 'Your.Package'
Expand Down
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ Sandstorm:
redirect:
# To activate redirection, make these settings:
afterLogin:
toOriginalRequest: false
action: 'action'
controller: 'Controller'
package: 'Your.Package'
Expand All @@ -169,6 +170,9 @@ Sandstorm:
package: 'Your.Package'
```

Set `toOriginalRequest` to `true` if you want to redirect to the original request after a successful login.
When no original request is present the `toOriginalRequest` setting will be ignored.

### Via node properties
When using the package within Neos, you have another possibility: you can set properties on the LoginForm node type.
The pages you link here will be shown after users log in or out. Please note that when a login/logout form is displayed
Expand Down

0 comments on commit 672a202

Please sign in to comment.