Skip to content

[6.x] Front-end login route#19220

Open
brianjhanson wants to merge 13 commits into
6.xfrom
feature/fe-login-route
Open

[6.x] Front-end login route#19220
brianjhanson wants to merge 13 commits into
6.xfrom
feature/fe-login-route

Conversation

@brianjhanson

Copy link
Copy Markdown
Contributor

Exposes a POST to your loginPath setting when front-end registration is enabled. Front-end login forms should post to that path to attempt a log in.

This also fixed some odd behavior I saw when logging out where I was getting redirected back to the previous page instead of dumped on the homepage (as was the case in Craft 5).

Fixes a lil' bug with deleting the home route from the UI that I noticed along the way

You were previously unable to delete the "home" route becuase `uriParts` was not on the `$route` variable
Comment thread src/Http/Controllers/Auth/LoginController.php Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR exposes a front-end POST route at the configured loginPath (when front-end user routes are enabled), adjusts logout redirect behavior to consistently honor postLogoutRedirect (defaulting to the site root), and hardens route deletion event payloads when a route is missing uriParts.

Changes:

  • Add POST routing for front-end logins at loginPath.
  • Fix logout redirects to use postLogoutRedirect (or site root) rather than falling back to back().
  • Prevent errors when deleting routes that don’t have uriParts set, and add feature tests for logout redirect behavior.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
routes/web.php Registers a new POST route for loginPath to support front-end login form submissions.
src/Http/Controllers/Auth/LoginController.php Updates non-JSON logout responses to redirect to the site URL for postLogoutRedirect.
tests/Feature/Http/Controllers/Auth/LoginControllerTest.php Adds tests ensuring logout redirects don’t fall back to the referrer and honor configured redirects.
src/Route/Routes.php Makes route deletion events resilient when uriParts is missing in project config data.

Comment thread routes/web.php Outdated
@linear-code

linear-code Bot commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

CMS-2264

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants