Skip to content

Avoid redirects from onAuthenticationSuccess to /logout #51313

@SiestaCat

Description

@SiestaCat

Description

Hello.
If the user is not logged in and go to /logout uri, when logs in next time it redirects to /logout

I think this is a problem.

This is because target_path session var.

Example

Edit LoginFormAuthenticator.tpl.php

if ($targetPath = $this->getTargetPath($request->getSession(), $firewallName)) {
            if(str_contains($targetPath, '/logout'))
            {
                $this->removeTargetPath($request->getSession(), $firewallName);
            } else {
                return new RedirectResponse($targetPath);
            }
        }

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions