1

I click on forgot password page

it redirect me to http://example.com/user/password which is fine

now when i enter email id . it redirect me to

"http//example.com/user */. I want it to redirect another page

http://example.com/request-access

Any idea?

Thanks

  • you can use rules module to accomplish this. – shrish Apr 29 '15 at 9:08
  • Can u tell me what rule i need to implement – Hitu Bansal Apr 29 '15 at 9:09
4

You can add your own submit handler to the form :

function CUSTOM_form_alter(&$form, &$form_state, $form_id) {
  if($form_id == 'user_reset') {
    $form['#submit'][] = 'CUSTOM_form_submit';
  }
}

function CUSTOM_form_submit($form, &$form_state) {
  $form_state['redirect'] = 'request-access';
}
0

I'm not sure if this is within the feature set of the LoginToboggan module, but you may want to give it a try since at least similar features are on the featre list:

  1. Optionally redirect the user to a specific page upon validation of their e-mail address.

and also plays together with Rules:

  1. Integrates with Rules module to do various tasks when a user validates via email validation process (see http://drupal.org/node/880904 for an example)
0

I think Login Destination module will be helpfull. Just try it. Check https://www.drupal.org/project/login_destination

0

To achieve this, I prefer to have a custom trigger which will give freedom to end user to select the page of his choice whenever he/she wants, instead of fiddling with code every time. Use below code to create a custom module and install it in your environment. Once done you will find the trigger in your triggers list.

/**
 * Implements hook_trigger_info().
 * 
 * Below we have created one trigger for passoword reset which will help user to define an action for it based on the req.
 * 
 * The trigger belongs to User group and has a custom created hook called user_password_reset
 * 
 * This will appear in the list of triggers
 */

function your_module_trigger_info() {
    return array(
            'user' => array(
                    'user_password_reset' => array(
                            'label' => t('After password reset'),
                    ),
            ),
    );
}

/**
 * 
 * @param  $form Form data
 * @param  $form_state 
 * @param  $form_id
 * 
 * Implemtents hook_form_FORM_ID_alter(&$form, &$form_state, $form_id)
 * 
 * This is used to call our trigger event on password reset request form submit
 */

function your_module_form_user_pass_alter( &$form, &$form_state, $form_id) {
    $form['#submit'][] = 'your_module_user_password_reset';
}

/**
 *  Custom function your_module_user_password_reset()
 *  
 *  This will execute actions assigned to the trigger.
 */

function your_module_user_password_reset() {
    $aids = trigger_get_assigned_actions('user_password_reset');

    $context = array(
            'group' => 'user',
            'hook' => 'user_password_reset',
    );

    actions_do(array_keys($aids), (object) $options, $context);
}

Please let me know if you find any issues with it.

Thanks!!

-1

If you want to close all the sessions after reset password, you can play with Rules and hybridauth modules.

Steps:

  1. Install the module and configure it.
  2. Add a rule "Logout after password update" or whatever name you want to give here.
  3. Select event "After updating an existing user account" .
  4. Once you select an event you will have to add conditions and actions based on which your rule works. Add a condition "Execute php code".
  5. Now a page will get opened where you can add your one liner php code.

    return $account_unchanged->pass != $account->pass;

save it and go back to your rules page.

  1. Add an action "Destroy session" and you are done.
  • And how can he configure the target URL now? – Rainer Feike Jul 5 '16 at 13:00
  • Once you are done with the reset password , you will be taken to login page so no need to configure target URL. – user63197 Jul 7 '16 at 9:49

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.