Changing entity.user.edit_form path results in 403 access denied

by Skywalker   Last Updated June 23, 2018 17:07 PM

I want to change the path of the user edit page because i have made my own page with a custom block. The new path does not contain any user id because i programmatically load the UID into the form based on the current user id. This works all fine, the page is on /profile which shows me the user edit form and works as expected.

However when anyone uses a password reset link it redirects to the /user/[uid]/edit?pass-reset-token=[token]. I want this to be /profile?pass-reset-token=[token]. When i manually add the token parameter to the profile url it works fine and hides the current password field.

So what i tried is changing the entity.user.edit_form path with a route subscriber -> alterRoutes() using this code:

if ($route = $collection->get('entity.user.edit_form')) {
      $route->setPath('/profile');
}

Now the password reset url actually redirects me to /profile?pass-reset-token=[token] however it shows me an access denied page. What am i doing wrong?

Tags : 8 users forms routes


Related Questions



How do I add custom tab in the user profile page?

Updated February 18, 2017 09:07 AM

Permission to see link based on role

Updated September 06, 2018 11:07 AM

Full urls to internal pages logging users out

Updated October 20, 2017 05:07 AM