Somewhat related to: #894886: Redirect administrators to Dashboard after log in should check user permissions

Total Control's implementation of hook_user breaks password reset functionality if a user is granted a role on creation that contains "Has total control" permissions.

Steps to recreate:

1) Create role w/ "Has Total Control" perm.
2) Create user, grant them role from step 1. Make sure to notify the user via email.
3) Follow reset link from user's email to site.
4) Click login button
5) Instead of being redirected to user/[uid]/reset, Total Control kicks in and redirects to the TC Dashboard.

A simple solution is to check arg(0) and arg(1) to see if a user is coming in from the Password Reset page (in total_control.module)

/**
 * Implementation of hook_user().
 *
 * Redirects to the dashboard if configured.
 */
function total_control_user($op, &$edit, &$account, $category = NULL){
  if ((arg(0) != 'user') && arg(1) != 'reset') {
    if (($op == 'login') && (variable_get('total_control_login_redirect', 0) == 1 && user_access('have total control'))){
      drupal_goto('admin/dashboard');
    }
  }
}

Found using TC1.2, with the above patch from Redirect administrators to Dashboard after log in should check user permissions applied.

Comments

guypaddock’s picture

My vote would be to check for a "destination=" parameter on log-in, assuming that's what's used by the password reset.

Login Destination has run into similar issues with redirecting on log-in.

markwittens’s picture

Ran into this problem before and again today, thanks molenick for sharing your solution!

mrfelton’s picture

This is also a problem when using the Login one time module.

jenlampton’s picture

Issue summary: View changes

Updated issue summary to include proper link formating

jenlampton’s picture

Status: Active » Needs review
StatusFileSize
new673 bytes

Thanks for the fix!

jenlampton’s picture

Status: Needs review » Fixed

this fix is committed to -dev and will be included in the next release.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

Anonymous’s picture

Issue summary: View changes

trying again