如何以编程方式检查密码在 Drupal 7 中是否有效?
How to programmatically check if password is valid in Drupal 7?
我正在使用 Drupal 7 并创建自定义表单来更新用户密码。在我必须检查用户提供的旧密码是否真的是用户密码之前。
有没有办法在 Drupal 7 中做到这一点?
感谢您的帮助!
使用 user_check_password 就可以了:
user_check_password($user_old_password, $user)
Return 如果旧密码与与用户对象关联的密码匹配,则为真。
我正在使用 Drupal 7 并创建自定义表单来更新用户密码。在我必须检查用户提供的旧密码是否真的是用户密码之前。
有没有办法在 Drupal 7 中做到这一点?
感谢您的帮助!
使用 user_check_password 就可以了:
user_check_password($user_old_password, $user)
Return 如果旧密码与与用户对象关联的密码匹配,则为真。