0

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?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.