日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 运维知识 > 数据库 >内容正文

数据库

drupal mysql hash密码_變更drupal7用戶密碼加密方式

發布時間:2023/12/16 数据库 22 豆豆
生活随笔 收集整理的這篇文章主要介紹了 drupal mysql hash密码_變更drupal7用戶密碼加密方式 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

在drupal程序的includes文件夾下添加 mypassword.inc 文件,文件內容如下:

DEBUG mypassword.inc _password_crypt::password = '" . $password . "'";

return md5($password);

}

/**

* Parse the log2 iteration count from a stored hash or setting string.

*/

function _password_get_count_log2($setting) {

$itoa64 = _password_itoa64();

return strpos($itoa64, $setting[3]);

}

/**

* Hash a password using a secure hash.

*

* @param $password

* A plain-text password.

* @param $count_log2

* Optional integer to specify the iteration count. Generally used only during

* mass operations where a value less than the default is needed for speed.

*

* @return

* A string containing the hashed password (and a salt), or FALSE on failure.

*/

function user_hash_password($password, $count_log2 = 0) {

return _password_crypt($password);

}

/**

* Check whether a plain text password matches a stored hashed password.

*

* Alternative implementations of this function may use other data in the

* $account object, for example the uid to look up the hash in a custom table

* or remote database.

*

* @param $password

* A plain-text password

* @param $account

* A user object with at least the fields from the {users} table.

*

* @return

* TRUE or FALSE.

*/

function user_check_password($password, $account) {

$stored_hash = $account->pass;

$hash = _password_crypt($password);

//echo "

DEBUG mypassword.inc user_check_password::stored_hash = '" . $stored_hash . "'";

//echo "

DEBUG mypassword.inc user_check_password::hash = '" . $hash . "'";

return ($hash && $stored_hash == $hash);

}

/**

* Check whether a user's hashed password needs to be replaced with a new hash.

*

* This is typically called during the login process when the plain text

* password is available. A new hash is needed when the desired iteration count

* has changed through a change in the variable password_count_log2 or

* DRUPAL_HASH_COUNT or if the user's password hash was generated in an update

* like user_update_7000().

*

* Alternative implementations of this function might use other criteria based

* on the fields in $account.

*

* @param $account

* A user object with at least the fields from the {users} table.

*

* @return

* TRUE or FALSE.

*/

function user_needs_new_hash($account) {

// Check whether this was an updated password.

if ((strlen($account->pass) != DRUPAL_HASH_LENGTH)) {

return TRUE;

}

return FALSE;

// Ensure that $count_log2 is within set bounds.

//$count_log2 = _password_enforce_log2_boundaries(variable_get('password_count_log2', DRUPAL_HASH_COUNT));

// Check whether the iteration count used differs from the standard number.

//return (_password_get_count_log2($account->pass) !== $count_log2);

}

?>

總結

以上是生活随笔為你收集整理的drupal mysql hash密码_變更drupal7用戶密碼加密方式的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。