Browse Source

Redirect to previous page after login

Jordi Boggiano 12 years ago
parent
commit
e4fcbdc2ea

+ 3 - 0
app/Resources/HWIOAuthBundle/views/Connect/login.html.twig

@@ -25,6 +25,9 @@
                     <label for="remember_me">{{ 'security.login.remember_me'|trans({}, 'FOSUserBundle') }}</label>
                 </div>
 
+                {% if packagist_host and packagist_host in app.request.headers.get('Referer') %}
+                    <input type="hidden" name="_target_path" value="{{ app.request.headers.get('Referer') }}" />
+                {% endif %}
                 <input type="submit" id="_submit" name="_submit" value="{{ 'security.login.submit'|trans({}, 'FOSUserBundle') }}" />
             </form>
 

+ 1 - 0
app/config/config.yml

@@ -24,6 +24,7 @@ twig:
     strict_variables: %kernel.debug%
     globals:
         google_analytics: %google_analytics%
+        packagist_host: %packagist_host%
 
 # Assetic Configuration
 assetic:

+ 2 - 1
app/config/parameters.yml.dist

@@ -12,7 +12,8 @@ parameters:
     mailer_from_email: admin@example.org
     mailer_from_name: Admin Team
 
-    # router.request_context.host: example.org
+    # packagist_host: example.org
+    # router.request_context.host: %packagist_host%
     # router.request_context.scheme: https
 
     redis_dsn: redis://localhost/1