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.
| Comment | File | Size | Author |
|---|---|---|---|
| #4 | avoid_password_reset_redirect-931470-4.patch | 673 bytes | jenlampton |
Comments
Comment #1
guypaddock commentedMy 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.
Comment #2
markwittens commentedRan into this problem before and again today, thanks molenick for sharing your solution!
Comment #3
mrfelton commentedThis is also a problem when using the Login one time module.
Comment #3.0
jenlamptonUpdated issue summary to include proper link formating
Comment #4
jenlamptonThanks for the fix!
Comment #5
jenlamptonthis fix is committed to -dev and will be included in the next release.
Comment #6.0
(not verified) commentedtrying again