Skip to content

Commit 68c52fc

Browse files
committed
feature #764 Redirect to post page after success login if necessary (yceruto)
This PR was merged into the master branch. Discussion ---------- Redirect to post page after success login if necessary Fixes #763 Commits ------- 792369f Redirect to post page after success login if necessary
2 parents 5ae66d8 + 792369f commit 68c52fc

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

templates/blog/post_show.html.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
{{ render(controller('App\\Controller\\BlogController:commentForm', {'id': post.id})) }}
2626
{% else %}
2727
<p>
28-
<a class="btn btn-success" href="{{ path('security_login') }}">
28+
<a class="btn btn-success" href="{{ path('security_login', {'next': app.request.pathInfo}) }}">
2929
<i class="fa fa-sign-in" aria-hidden="true"></i> {{ 'action.sign_in'|trans }}
3030
</a>
3131
{{ 'post.to_publish_a_comment'|trans }}

templates/security/login.html.twig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
<label for="password">{{ 'label.password'|trans }}</label>
2929
<input type="password" id="password" name="_password" class="form-control" />
3030
</div>
31+
<input type="hidden" name="_target_path" value="{{ app.request.get('next') }}"/>
3132
<input type="hidden" name="_csrf_token" value="{{ csrf_token('authenticate') }}"/>
3233
<button type="submit" class="btn btn-primary">
3334
<i class="fa fa-sign-in" aria-hidden="true"></i> {{ 'action.sign_in'|trans }}

0 commit comments

Comments
 (0)