Skip to content

Commit

Permalink
do not redirect to confirmation page after completion form and fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
alexander-schranz committed Jun 22, 2016
1 parent 0df9ecc commit 90e5e5a
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 22 deletions.
2 changes: 1 addition & 1 deletion DependencyInjection/Configuration.php
Expand Up @@ -186,7 +186,7 @@ public function getConfigTreeBuilder()
->end()
// Password Forget
->arrayNode(self::TYPE_PASSWORD_FORGET)
->addDefaultsIfNotSet()
->addDefaultsIfNotSet()
->children()
// Password Forget configuration
->scalarNode(self::TEMPLATE)->defaultValue('SuluCommunityBundle:community:password-forget.html.twig')->end()
Expand Down
30 changes: 10 additions & 20 deletions EventListener/CompletionListener.php
Expand Up @@ -76,26 +76,14 @@ public function __construct(
*/
public function onRequest(GetResponseEvent $event)
{
if (!$event->isMasterRequest()) {
// don't do anything if it's not the master request
return;
}

$request = $event->getRequest();

if ($request->isMethod('post')) {
// don't do anything if it's not a post request
return;
}

if ($request->isXmlHttpRequest()) {
// don't do anything if it's a ajax request
return;
}

$completionUrl = $this->router->generate('sulu_community.completion');
if ($request->getPathInfo() === $completionUrl) {
// don't do anything if it's the completion url

if (!$event->isMasterRequest()
|| $request->isMethod('post')
|| $request->isXmlHttpRequest()
|| $request->getPathInfo() === $completionUrl
) {
return;
}

Expand All @@ -109,8 +97,10 @@ public function onRequest(GetResponseEvent $event)
return;
}

$session = $request->getSession();
$session->set(self::SESSION_STORE, $request->getUri());
if ($request->attributes->get('_route') !== 'sulu_community.confirmation') {
$session = $request->getSession();
$session->set(self::SESSION_STORE, $request->getUri());
}

$webspaceKey = $this->requestAnalyzer->getWebspace()->getKey();
$validator = $this->getValidator($webspaceKey);
Expand Down
2 changes: 1 addition & 1 deletion Tests/app/config/routing_website.yml
@@ -1,3 +1,3 @@
sulu_community:
type: portal
resource: "@SuluCommunityBundle/Resources/config/routing.xml"
resource: "@SuluCommunityBundle/Resources/config/routing_website.xml"

0 comments on commit 90e5e5a

Please sign in to comment.