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

erikwebb’s picture

Title: Sub-module Contraint Delay not converted to D7 format » Delay constraint needs to be converted to D7 database api
Version: 7.x-1.0-beta2 » 7.x-1.x-dev
Status: Active » Needs review
StatusFileSize
new910 bytes

Please confirm with the attached patch.

erikwebb’s picture

Priority: Normal » Critical
Issue tags: +D7 stable release blocker
erikwebb’s picture

matt v.’s picture

Status: Needs review » Reviewed & tested by the community

The 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.

erikwebb’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.