You are here

function Delay_Constraint::validate in Password Policy 5

Overrides Constraint::validate

File

constraints/constraint_delay.php, line 15

Class

Delay_Constraint

Code

function validate($plaintext_password, $user = NULL) {
  $last_change = db_result(db_query_range("SELECT MAX(created) FROM {password_policy_users} WHERE uid = %d", $user->uid, 0, 1));
  if (!empty($last_change)) {

    // constraint is set in hours, so it gets converted to seconds with *60*60
    return time() - $this->minimumConstraintValue * 60 * 60 > $last_change;
  }
  return TRUE;
}