summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorwebchick <webchick@24967.no-reply.drupal.org>2011-06-29 23:47:28 -0700
committerwebchick <webchick@24967.no-reply.drupal.org>2011-06-29 23:47:28 -0700
commitc40fde088c95cb6d44767b1b1a23f57f21894f63 (patch)
tree568a0ac4f67dcd78ed3b2be91d915d2f7a6a2bb5
parentdb4bc4b0a8540fd9ef564e29eb44885f989f5341 (diff)
downloadbrdo-c40fde088c95cb6d44767b1b1a23f57f21894f63.tar.gz
brdo-c40fde088c95cb6d44767b1b1a23f57f21894f63.tar.bz2
Issue #1198396 by pillarsdotnet, jhodgdon: Fixed Add required docs to user_pass_rehash() function.
-rw-r--r--modules/user/user.module21
1 files changed, 21 insertions, 0 deletions
diff --git a/modules/user/user.module b/modules/user/user.module
index 84430b2f7..e5fdb77b8 100644
--- a/modules/user/user.module
+++ b/modules/user/user.module
@@ -2287,6 +2287,27 @@ function user_cancel_url($account) {
return url("user/$account->uid/cancel/confirm/$timestamp/" . user_pass_rehash($account->pass, $timestamp, $account->login), array('absolute' => TRUE));
}
+/**
+ * Creates a unique hash value for use in time-dependent per-user URLs.
+ *
+ * This hash is normally used to build a unique and secure URL that is sent to
+ * the user by email for purposes such as resetting the user's password. In
+ * order to validate the URL, the same hash can be generated again, from the
+ * same information, and compared to the hash value from the URL. The URL
+ * normally contains both the time stamp and the numeric user ID. The login
+ * name and hashed password are retrieved from the database as necessary. For a
+ * usage example, see user_cancel_url() and user_cancel_confirm().
+ *
+ * @param $password
+ * The hashed user account password value.
+ * @param $timestamp
+ * A unix timestamp.
+ * @param $login
+ * The user account login name.
+ *
+ * @return
+ * A string that is safe for use in URLs and SQL statements.
+ */
function user_pass_rehash($password, $timestamp, $login) {
return drupal_hmac_base64($timestamp . $login, drupal_get_hash_salt() . $password);
}