diff --git a/Classes/Sandstorm/UserManagement/Domain/Service/Flow/FlowRedirectTargetService.php b/Classes/Sandstorm/UserManagement/Domain/Service/Flow/FlowRedirectTargetService.php index 38900ab..3a61ec8 100644 --- a/Classes/Sandstorm/UserManagement/Domain/Service/Flow/FlowRedirectTargetService.php +++ b/Classes/Sandstorm/UserManagement/Domain/Service/Flow/FlowRedirectTargetService.php @@ -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) diff --git a/Configuration/Settings.yaml b/Configuration/Settings.yaml index 1b037e7..e686b82 100644 --- a/Configuration/Settings.yaml +++ b/Configuration/Settings.yaml @@ -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' diff --git a/README.md b/README.md index e961f34..0735aba 100644 --- a/README.md +++ b/README.md @@ -160,6 +160,7 @@ Sandstorm: redirect: # To activate redirection, make these settings: afterLogin: + toOriginalRequest: false action: 'action' controller: 'Controller' package: 'Your.Package' @@ -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