在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用戶密碼加密方式相关推荐

  1. drupal mysql hash密码_【Drupal】如何重置Drupal 7的用户密码

    由于好久没有登录本机的Drupal 7网站,发现早已忘记了admin密码.打开phpmyadmin想直接数据库更改密码,却发现Drupal 7已不再采用Drupal 6和5时代的简单的MD5加密了.据 ...

  2. 找回mysql root密码_找回MySQL的root密码

    实验介绍:MySQL的root密码丢失,无法登陆.需要重置其root密码 环境介绍:编译安装的MySQL 这篇博客介绍的找回 mysql root 密码是 mysql 基于编译安装的,如果是多实例下的 ...

  3. 阿里云 mysql 修改密码_阿里云mysql修改密码

    MYSQL的密码我们并不经常修改,但有时我们会忘记密码需要修改,还会将密码更改为自己更容易记住的!下面介绍两种更改mysql密码的方法 方法一: 此方法主要是记得旧密码然后更改为新的密码 1)先输入m ...

  4. 服务器安装mysql要密码_在阿里云服务器上安装mysql及重置密码

    参考链接:https://www.cnblogs.com/ljysy/p/10324854.html 下载与安装MySQL: 这里采用Yum管理好了各种rpm包的依赖,能够从指定的服务器自动下载RPM ...

  5. 安装mysql没有密码_如何在没有密码提示的情况下安装MySQL?

    问题描述 我试图在没有密码提示的情况下在Ubuntu Natty上安装MySQL.但是,在主安装后的某个阶段,我总是不断提示输入密码. 另外,当我输入我认为应该是我的密码(mymysqlpass)的密 ...

  6. bitnami mysql默认密码_重置Bitnami mysql 密码

    mysql 默认密码为安装时设置的系统应用密码 How to reset the MySQL root password on Windows? If you don't remember your ...

  7. 大数据mysql 更换密码_解决重置Mysql root用户账号密码问题

    问题描述: 使用mysqladmin.exe执行命令时出现以下错误提示: mysqladmin: connect to server at 'localhost' failed error: 'Acc ...

  8. ctf mysql hash传递_分享个 CTF 小工具 bruteHASH

    别问,问就是为了 CTF 思路源于一次三小时十二题的内部 CTF 竞赛,其中一道简单 MISC 给出明文范围(字母数字)和 MD5 开头,要求穷举出 flag--这当然不难,python 十几行代码搞 ...

  9. mysql hash函数_运维日记| MySQL/Oracle深度解析之一:逻辑读

    前言 THE FIRST 比较数据库优劣.异同的文章有很多了,使用压测工具,进行不同压力下的测试,就能大致上比较出来哪种数据库是"最快"的数据库.但从有经验的数据架构.DBA等专业 ...

  10. php mysql 修改密码_设置及修改MySQL root用户密码

    设置及修改MySQL root用户密码 MySQL数据库用户安全策略介绍 安装mysql数据库后,默认的管理员root密码是空,这很不安全,因此需要设置一个密码 为root设置密码 删除无用的MySQ ...

最新文章

  1. C语言-转义字符注意事项
  2. C语言实现卡塔兰数catalan(附完整源码)
  3. ubuntu 12.04 LTS 64位兼容运行32位程序
  4. 数据库水平切分(MyCat分片)
  5. 苹果确认部分AirPods Pro存在静电噪音等声音问题 将免费更换
  6. jeval 公式_几款公式解析工具的比较
  7. 实战:配置内网DNS实现内部域名解析
  8. 中国互联网今日正式满 20 岁
  9. 全网首发:doubango提示text relocations错误的解决办法
  10. Navicat Premium 注册机 激活报错
  11. 奥本海姆《数字信号处理》课后题解析(一)
  12. QuickFlow-如何通过QFD and ExecuteCode获取其他列表数据
  13. 未来10年互联网的十大发展趋势
  14. Property ‘validationMessageSource‘ threw exception
  15. React -- Switch的使用
  16. 通过XtraBackup进行数据库表备份和表空间传输实例
  17. 区块链技术的应用在数字藏品上的体现
  18. 大疆19年校招0804笔试A卷
  19. 未来科技业界的10大风口
  20. 墨者学院SQL手工注入靶场漏洞详解

热门文章

  1. 使用USBWriter等工具做U盘启动盘后容量变小的解决办法
  2. 物理内存是什么是计算机的显卡内存吗,物理内存和虚拟内存是什么意思怎么理解...
  3. RK3568平台开发系列讲解(安卓适配篇)Android11旋转屏幕
  4. 狗和猫有相同的情绪反应吗?
  5. 怎么调用计算机任务管理器,任务管理器怎么打开
  6. Hive数据分析案例
  7. 第三方接入-飞猪酒店商品发布流程
  8. 台式计算机有没有无线连接模块,台式机能不能连接wifi_台式机怎么连接wifi
  9. 二进制文件是什么?到底二进制文件和纯文本文件的区别是什么?为什么图像、音频是二进制文件?
  10. LiveQing私有云流媒体-云端录像时间轴视频及列表视图