在网上搜索后,我发现使用drupal 7,密码不再通过md5加密。
在Drupal 7中获得密码的可能方法是什么??
发布于 2014-04-24 07:58:12
使用drupal 7,密码不再通过md5加密。在drupal7中有几种获取/设置密码的方法。使用drush (供您参考,不在您的情况下使用):
drush upwd admin --password="newpassword"如果您没有drush,您可以访问服务器:(用于您的信息,在您的情况下不使用)
cd <drupal root directory>
php scripts/password-hash.sh 'myPassword'现在,复制结果哈希并将其粘贴到查询中:
update users set name='admin', pass='pasted_big_hash_from_above' where uid=1;发布于 2014-04-24 09:21:54
谢谢马利克。
经过搜索,我找到了不同的解决方案。下面的解决方案也有效
如果您正在处理无法连接的远程环境,则可以将指定的代码放入诸如password.php这样的文件中:
<?php
if (isset($_GET['p'])) {
require_once dirname(__FILE__) . '/includes/bootstrap.inc';
require_once dirname(__FILE__) . '/includes/password.inc';
print _password_crypt('sha512', $_GET['p'], _password_generate_salt(DRUPAL_HASH_COUNT));
exit();
}
print "No password to hash.";然后使用:http://domain.tld/password.php?p='MyPassword'访问您的站点。散列将出现在浏览器的选项卡上。一旦你这样做了,别忘了移除它。因此,如果要使用密码函数生成,请查看_password_crypt()和_password_generate_salt()
发布于 2014-04-24 16:52:26
user_hash_password()函数可以用于散列密码,如果要在外部使用Drupal,则需要引导Drupal配置。
chdir("/path/to/drupal");
require_once './includes/bootstrap.inc';
drupal_bootstrap(DRUPAL_BOOTSTRAP_CONFIGURATION);
user_hash_password($password);https://stackoverflow.com/questions/23263039
复制相似问题