You are here

function password_strength_requirements in Password Strength 7

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

Implementation of 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;
}