File tree Expand file tree Collapse file tree 2 files changed +19
-3
lines changed
Resources/views/Registration Expand file tree Collapse file tree 2 files changed +19
-3
lines changed Original file line number Diff line number Diff line change @@ -140,6 +140,23 @@ public function confirmedAction()
140140
141141 return $ this ->render ('FOSUserBundle:Registration:confirmed.html.twig ' , array (
142142 'user ' => $ user ,
143+ 'targetUrl ' => $ this ->getTargetUrlFromSession (),
143144 ));
144145 }
146+
147+ private function getTargetUrlFromSession ()
148+ {
149+ // Set the SecurityContext for Symfony <2.6
150+ if (interface_exists ('Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface ' )) {
151+ $ tokenStorage = $ this ->get ('security.token_storage ' );
152+ } else {
153+ $ tokenStorage = $ this ->get ('security.context ' );
154+ }
155+
156+ $ key = sprintf ('_security.%s.target_path ' , $ tokenStorage ->getToken ()->getProviderKey ());
157+
158+ if ($ this ->get ('session ' )->has ($ key )) {
159+ return $ this ->get ('session ' )->get ($ key );
160+ }
161+ }
145162}
Original file line number Diff line number Diff line change 44
55{% block fos_user_content %}
66 <p >{{ ' registration.confirmed' | trans({' %username%' : user .username }) }}</p >
7- {% if app .session is not empty %}
8- {% set targetUrl = app .session .get (' _security.' ~ app .security .token .providerKey ~ ' .target_path' ) %}
9- {% if targetUrl is not empty %}<p ><a href =" {{ targetUrl }}" >{{ ' registration.back' | trans }}</a ></p >{% endif %}
7+ {% if targetUrl %}
8+ <p ><a href =" {{ targetUrl }}" >{{ ' registration.back' | trans }}</a ></p >
109 {% endif %}
1110{% endblock fos_user_content %}
You can’t perform that action at this time.
0 commit comments