twig - Add "Return to" to FOSUserBundle login form -


the title says everything. code have enter where?

if dont understand title, mean give template this

<a href="{{ path('fos_user'_security_login', {}|merge({'redir': 'blog_default_index'})) }}">link</a> 

and output should be... (example)

<a href="http://localhost/login?redir=http://localhost/blog/index" 

and think controller need like...

/*  * @route('/login', defaults={"redir" = "blog_default_index"})  */ 

please help. have no idea

try build href in 2 steps:

<a href="{{ path('fos_user_security_login') }}?redir={{ path('blog_default_index') }}">link</a> 

alternatively if add _target_path hidden input login form, user redirect path:

<form>     ...     <input type="hidden" name="_target_path" value="{{ path('blog_default_index') }}" /> </form> 

Comments

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -