We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 89c18b6 + f6688cd commit 888068aCopy full SHA for 888068a
1 file changed
Controller/RegistrationController.php
@@ -172,7 +172,19 @@ public function confirmedAction(Request $request): Response
172
173
private function getTargetUrlFromSession(SessionInterface $session): ?string
174
{
175
- $key = sprintf('_security.%s.target_path', $this->tokenStorage->getToken()->getProviderKey());
+ $token = $this->tokenStorage->getToken();
176
+
177
+ if (method_exists($token, 'getFirewallName')) {
178
+ $firewallName = $token->getFirewallName();
179
+ } elseif (method_exists($token, 'getProviderKey')) {
180
+ // BC with Symfony 5.x
181
+ $firewallName = $token->getProviderKey();
182
+ } else {
183
+ return null;
184
+ }
185
186
187
+ $key = sprintf('_security.%s.target_path', $firewallName);
188
189
if ($session->has($key)) {
190
return $session->get($key);
0 commit comments