Preserve return URL when confirming logout

This commit is contained in:
Toby Zerner 2017-11-29 13:47:00 +10:30
parent ea2fc1ff8a
commit ba769e0c7e
2 changed files with 3 additions and 2 deletions

View File

@ -107,7 +107,8 @@ class LogOutController implements ControllerInterface
if (array_get($request->getQueryParams(), 'token') !== $csrfToken) {
$view = $this->view->make('flarum.forum::log-out')
->with('csrfToken', $csrfToken)
->with('forumTitle', $this->settings->get('forum_title'));
->with('forumTitle', $this->settings->get('forum_title'))
->with('return', array_get($request->getQueryParams(), 'return'));
return new HtmlResponse($view->render());
}

View File

@ -7,7 +7,7 @@
<p>{{ $translator->trans('core.views.log_out.log_out_confirmation', ['{forum}' => $forumTitle]) }}</p>
<p>
<a href="{{ $url->toRoute('logout') }}?token={{ $csrfToken }}" class="button">
<a href="{{ $url->toRoute('logout') }}?token={{ $csrfToken }}@if ($return)&return={{ urlencode($return) }}@endif" class="button">
{{ $translator->trans('core.views.log_out.log_out_button') }}
</a>
</p>