You are here

function password_strength_requirements in Password Strength 6.2

Same name and namespace in other branches
  1. 7 password_strength.install \password_strength_requirements()

Implements hook_requirements().

File

./password_strength.install, line 11
Installation and requirements for Password Strength module.

Code

function password_strength_requirements($phase) {
  $requirements = array();
  $installed = FALSE;
  if (class_exists('ZxcvbnPhp\\Zxcvbn')) {
    $installed = TRUE;
  }
  switch ($phase) {
    case 'runtime':
      if (!$installed) {
        $requirements['password_strength'] = array(
          'title' => t('Password Strength'),
          'severity' => REQUIREMENT_ERROR,
          'value' => t('Library not available'),
          'description' => t('The Password Strength library Zxcvbn-PHP is not detected. Consult the README.md for installation instructions.'),
        );
      }
      break;
  }
  return $requirements;
}