If my user click to "forgot password", and email with a one-time login is sended.
When the user clicks the given link, he's redirected to this page /user/reset/$id
with the user_pass_reset
form (basically containing a single button for the one-time login)
I'd like to redirect to a custom page after the user clicked on the one-time login button, but can't find out why this code doesn't works
/**
* Implements hook_form_BASE_FORM_ID_alter().
*/
function module_form_user_pass_reset_alter(&$form, \Drupal\Core\Form\FormStateInterface $form_state, $form_id)
{
$form['actions']['submit']['#submit'][] = '_module_user_reset_pass_form_submit';
}
function _module_user_reset_pass_form_submit(&$form, FormStateInterface $form_state) {
$form_state->setRedirect('module.custom_reset_password_page');
}
I'm using drupal 9