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')) {

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 acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.