Prevent password reset urls from being redirected at login I'm using the following code to redirect users at login (Drupal 6):

function hook_user($op, &amp;$edit, &amp;$account, $category = NULL) {
switch ($op) {
    case 'login':
        if (_cns_user($account)) {
            unset($_GET['destination']);
            unset($_REQUEST['destination']);
            drupal_goto('user/'. $account-&gt;uid .'/training', NULL, 'steps');
        }
        break;
    }
}


The problem I have is that this doesn't allow for users to be redirected to the password reset page (user/reset/) when needed. Is there a way to prevent the reset url from being redirected? Thanks in advance.
The simplest way would probably be to just test for the path, which you can get access to via arg(). Something like this would do the trick:

function hook_user($op, &amp;$edit, &amp;$account, $category = NULL) {
  switch ($op) {
    case 'login':
      if (_cns_user($account) &amp;&amp; !(arg(0) == 'user' &amp;&amp; arg(1) == 'reset')) {
        unset($_GET['destination']);
        unset($_REQUEST['destination']);
        drupal_goto('user/'. $account-&gt;uid .'/training', NULL, 'steps');
      }
      break;
  }
}