Hi,
It looks to me like the password_policy_constraint_delay_validate(() function has escaped D7 conversion - it still uses D6 database functions. The function ought to look something like this, I believe:
function password_policy_constraint_delay_validate($password, $constraint, $uid) {
$query = db_select('password_policy_history');
$query->addExpression('MAX(created)');
$last_change = $query->condition('uid', $uid)
->range(0, 1)
->execute()
->fetchField();
if ($last_change) {
// Constraint is set in hours, so it gets converted to seconds with *60*60.
return time() - ($constraint*60*60) > $last_change;
}
return TRUE;
}
This is what I have implemented on my site in any case.
Regards,
- Paul
Comments
Comment #1
erikwebb commentedPlease confirm with the attached patch.
Comment #2
erikwebb commentedComment #3
erikwebb commentedComment #4
matt v. commentedThe patch looks good to me. I ran the tests in 7.x-1.x-dev before applying the patch and they all passed. I then applied the patch and it applied cleanly. I then ran the tests again and they still all passed.
Admittedly, there don't appear to be any tests related to the delay_constraint. But it's also a relatively simple patch and it's the only remaining issue holding up #1387588: Create stable 7.x-1.0 release.
Comment #5
erikwebb commentedThanks for the test!
http://drupalcode.org/project/password_policy.git/commit/cb2abb9
Comment #7
erikwebb commentedIssue reopened at #1467184: Fatal error: Call to a member function condition() on a non-object in /.../password_policy/constraints/constraint_delay.inc.