? 729590.userreset.patch
Index: tokenauth.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/tokenauth/Attic/tokenauth.module,v
retrieving revision 1.11.4.10
diff -u -p -r1.11.4.10 tokenauth.module
--- tokenauth.module	17 Jul 2009 03:31:37 -0000	1.11.4.10
+++ tokenauth.module	3 May 2010 21:44:51 -0000
@@ -154,32 +154,35 @@ function tokenauth_reset() {
  * Menu callback: confirm reset  users token.
  */
 function tokenauth_user_reset_confirm() {
-  global $user;
-
-  return confirm_form(array(), t('Are you sure you want to reset this user token?'),
-           "user/$user->uid/tokenauth", t('After the token has been reset,  please update your feed readers or other aplications that depend on them. This action cannot be undone.'), t('Reset token'), t('Cancel'));
+  if (arg(0) == 'user' && is_numeric(arg(1))) {
+    $uid = arg(1);
+  }
+  return confirm_form(
+    array('uid' => array('#type' => 'hidden', '#value' => $uid)),
+    t('Are you sure you want to reset this user token?'),
+    "user/$uid/tokenauth",
+    t('After the token has been reset, please update your feed readers or other applications that depend on them. This action cannot be undone.'),
+    t('Reset token'),
+    t('Cancel')
+  );
 }
 
 /**
  * Handler for reset tokens confirmation
  */
-function tokenauth_user_reset_confirm_submit(&$form_state) {
-  global $user;
-
-  tokenauth_user_reset();
+function tokenauth_user_reset_confirm_submit($form, &$form_state) {
+  tokenauth_user_reset($form['uid']['#value']);
   drupal_set_message(t('The token has been reset.'));
-  $form_state['#redirect'] = "user/$user->uid/tokenauth";
+  $form_state['redirect'] = 'user/' . $form['uid']['#value'] . '/tokenauth';
 }
 
 /**
- * Reset a users token.
+ * Reset a user's token.
  */
-function tokenauth_user_reset() {
-  global $user;
-
+function tokenauth_user_reset($uid) {
   $length = variable_get('tokenauth_length', 10);
   $sql = "UPDATE {tokenauth_tokens} SET token = '%s' WHERE uid = %d";
-  db_query($sql, user_password($length), $user->uid);
+  db_query($sql, user_password($length), $uid);
 }
 
 /**
