implementing user has password in hook menu(实现用户在挂钩菜单中有密码)
问题描述
我们正在为 Drupal 7 站点实施 Web 服务(Web 服务代码不是 drupal 安装文件夹的一部分).
we are implementing a web service for a Drupal 7 site (the web service code is not part of drupal installation folder).
其中一项网络服务需要在网站上注册用户.主要障碍是获得 Drupal 也能识别的散列密码.
one of the web services needs to sign up the user on the site. the main hurdle was getting a hashed password that Drupal will also recognize.
为此,我遵循关于堆栈溢出的建议,以在 drupal 内实现 REST 服务并从外部服务代码调用该服务.(这部分似乎也是可能和可实现的).
for that , am following a suggestion made on stack overflow to Implement a REST service inside drupal and call that from the outside service code . (that part also seems possible and achieveable).
已经使用以下代码实现了密码哈希服务:
have implemented a password hashing service with following code:
function GetHashedPassword($string)
{
require_once DRUPAL_ROOT . '/' . variable_get('password_inc', 'includes/password.inc');
$hashedpw = user_hash_password($string);
$data = array(
'password' => $hashedpw
);
header("Access-Control-Allow-Origin: *");
drupal_json_output($data);
drupal_exit();
}
现在的主要问题是,即使使用相同的字符串调用此服务,它每次都会返回一个新的哈希值..
the main issue now is that whenever this service is called even with same string , it returns a new hashed value each time..
如果我们需要的东西实际上是可能的,请提供帮助,如果是的话,那么可以在上面的代码中修复什么
kindly assist if what we need is actually even possible and if so, then what could be fixed in the above code
任何帮助表示赞赏
推荐答案
Drupal user_hash_password 函数每次计算哈希时都会生成一个新的盐.这将导致生成新的哈希,因为盐可能与上一个不同.
The Drupal user_hash_password function generates a new salt each time it calculates the hash. This will cause a new hash to be generated since the salt is likely to be different to the last one.
这篇关于实现用户在挂钩菜单中有密码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:实现用户在挂钩菜单中有密码


- 正确分离 PHP 中的逻辑/样式 2021-01-01
- 如何定位 php.ini 文件 (xampp) 2022-01-01
- 没有作曲家的 PSR4 自动加载 2022-01-01
- 带有通配符的 Laravel 验证器 2021-01-01
- SoapClient 设置自定义 HTTP Header 2021-01-01
- PHP Count 布尔数组中真值的数量 2021-01-01
- Oracle 即时客户端 DYLD_LIBRARY_PATH 错误 2022-01-01
- 从 PHP 中的输入表单获取日期 2022-01-01
- Mod使用GET变量将子域重写为PHP 2021-01-01
- Laravel 仓库 2022-01-01