You are here

password_strength.install in Password Strength 6.2

Same filename and directory in other branches
  1. 7 password_strength.install

Installation and requirements for Password Strength module.

File

password_strength.install
View source
<?php

/**
 * @file
 * Installation and requirements for Password Strength module.
 */

/**
 * Implements hook_requirements().
 */
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;
}

/**
 * Implements hook_uninstall().
 */
function password_strength_uninstall() {
  variable_del('password_strength_default_required_score');
  variable_del('password_strength_default_password_length');
}