Add the ability to redirect after password reset

Created on 22 October 2019, about 5 years ago
Updated 5 July 2023, over 1 year ago

The task is to add the ability to redirect to a specific page after reset password using the link from the mail.

Feature request
Status

Closed: won't fix

Version

8.7 ⚰️

Component
User module 

Last updated about 22 hours ago

Created by

🇧🇾Belarus xanderzakh Minsk

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • 🇧🇪Belgium flyke

    This worked for me. It was not $form['#submit'] that I needed to alter, but instead $form['actions']['submit']['#submit'].

    /**
     * Implements hook_form_FORM_ID_alter().
     */
    function mymodule_form_user_form_alter(&$form, FormStateInterface $form_state) {
      $form['actions']['submit']['#submit'][] = '_mymodule_homepage_redirect_submit_handler';
    }
    
    /**
     * Custom submit callback to redirect to the homepage.
     */
    function _mymodule_homepage_redirect_submit_handler(array &$form, FormStateInterface $form_state) {
      // Redirect the user to the homepage.
      $form_state->setRedirect('<front>');
    }
Production build 0.71.5 2024