在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. 渐进式Web应用(PWA)入门教程(上)
  2. 纪念lxwcto(潜龙)
  3. Class.forName有什么作用
  4. 高阶前端开发人员必备工具-Node.JS知识讲解
  5. spring源码构建以及模块划分和依赖
  6. SAP Spartacus 服务器端渲染文件 server.js 和构建后的 main.js 对比
  7. 7-6 0-1背包 (20 分)(思路加详解+网格做法+动态规划)Come Baby !!!!!!!!!!!!!!
  8. python进行数据分析需要安装哪两个库_对Python进行数据分析_关于Package的安装问题...
  9. 算法之【大整数乘法】
  10. 取消xp开机默认登陆账户
  11. Vue使用阿里矢量图标库
  12. fiddler 安装配置,连接手机,抓包QQ小程序
  13. AHT20温湿度传感器数据采集
  14. HTML 转 PDF 之 wkhtmltopdf 工具精讲
  15. python 随机产生一个整数 并猜测该数字小游戏
  16. 接口测试常见面试题(含答案)
  17. 模式识别 | PRML概览
  18. 10.第三章 数字特征与特征函数(3)
  19. result returns more than one elements; nested exception is javax.persistence.NonUniqueResultExceptio
  20. Node.js 官网入门教程(二) npm(安装、包版本、卸载、npx)、package.json(scripts、devDependencies)package-lock.json(语义版本规则符号

热门文章

  1. 群发邮箱的软件哪个好?2021协议邮件群发软件推荐?
  2. Photoshop是什么?
  3. 数据库表插入中文数据时报错Incorrect string value: ‘\xE4\xBB\x8E\xE5\x85\xA5...‘ for column ‘name‘ at r
  4. 重装系统后有一个磁盘打不开,提示没有权限
  5. 分析社会热点与网络营销的关联
  6. php面试题大全及答案
  7. SH-SSS丨《ISSD: 基于迭代式语音分离的说话人日志系统》论文线上分享
  8. HDU 5773 (DP)
  9. hdu5773 2016年多校4 nlogn求LIS
  10. 基于Java Servlet 构建的在线音乐服务器