I've got this problem where once in a while, when a user uses the one time password link, instead of going to the password reset page, it takes them to the home page. Whenever this happens, in the error log I see this:

Path: /user/reset/[user ID]. Drupal\Core\Http\Exception\CacheableAccessDeniedHttpException: This route can only be accessed by anonymous users. in Drupal\Core\Routing\AccessAwareRouter->checkAccess() (line 118 of /var/www/html/web/core/lib/Drupal/Core/Routing/AccessAwareRouter.php).

I've found answers to why this can happen, but I haven't found an answer for why it happens sometimes. Do you have any suggestion on how to resolve it? Would it be a bad thing to make the form available to authenticated users?

  • Are the users authenticated when it occurs?
    – cilefen
    Jun 9, 2022 at 20:40
  • No. They wouldn't be. They are not logged in, submit a form to receive a one-time link to their email. I don't think it is cached credentials either. I made it happen with a user that hadn't logged in before.
    – zip_000
    Jun 9, 2022 at 21:33
  • Are there any authentication-related modules installed?
    – cilefen
    Jun 9, 2022 at 22:43
  • Maybe some login redirect module? Or something custom happening on hook_user_login?
    – leymannx
    Jun 9, 2022 at 22:56
  • There is a login redirect module, but this was happening before I added that. I'll look at the authentication modules tomorrow. Thanks for the suggestion!
    – zip_000
    Jun 10, 2022 at 1:05


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.