File tree Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -430,3 +430,24 @@ are now fully customized:
430430 <input type="hidden" name="back_to" value="<?php echo $view['router']->path('forgot_password') ?>" />
431431 <input type="submit" name="login" />
432432 </form>
433+
434+ Redirecting to the Last Accessed Page with ``TargetPathTrait ``
435+ --------------------------------------------------------------
436+
437+ The last request URI is stored in a session variable named
438+ ``_security.<your providerKey>.target_path `` (e.g. ``_security.main.target_path ``
439+ if the name of your firewall is ``main ``). Most of the times you don't have to
440+ deal with this low level session variable. However, if you ever need to get or
441+ remove this variable, it's better to use the
442+ :class: `Symfony\\ Component\\ Security\\ Http\\ Util\\ TargetPathTrait ` utility::
443+
444+ // ...
445+ use Symfony\Component\Security\Http\Util\TargetPathTrait;
446+
447+ $targetPath = $this->getTargetPath($request->getSession(), $providerKey);
448+
449+ // equivalent to:
450+ // $targetPath = $request->getSession()->get('_security.'.$providerKey.'.target_path');
451+
452+ .. versionadded :: 3.1
453+ The ``TargetPathTrait `` was introduced in Symfony 3.1.
You can’t perform that action at this time.
0 commit comments