You are here

function password_policy_tokens in Password Policy 7.2

Implements hook_tokens().

File

./password_policy.module, line 469
Enforces password policies.

Code

function password_policy_tokens($type, $tokens, $data, $options) {
  if ($type == 'password_expiration_date') {
    $replacements = array();
    foreach ($tokens as $key => $token) {
      if ($key == 'interval') {
        $replacements[$token] = format_interval($data['password_expiration_date'] - REQUEST_TIME);
      }
      else {
        $replacements[$token] = format_date($data['password_expiration_date'], $key);
      }
    }
    return $replacements;
  }
}