You are here

function ga_login_requirements in Google Authenticator login 8

Implements hook_requirements().

File

./ga_login.install, line 11
Installation related functions for GA Login module.

Code

function ga_login_requirements($phase) {
  $requirements = [];
  $requirements['ga_login'] = [
    'title' => t('Google Login Authenticator'),
  ];
  if (class_exists('\\Otp\\Otp')) {
    $version = method_exists('\\Otp\\OtpInterface', 'checkHotpResync') ? '2.1.0 or newer' : '2.0.0';
    $requirements['ga_login']['severity'] = REQUIREMENT_OK;
    $requirements['ga_login']['value'] = t('Third-party libraries');
    $requirements['ga_login']['description'] = t('One Time Passwords (christian-riesen/otp) @version is installed', [
      '@version' => $version,
    ]);
  }
  else {
    $requirements['ga_login']['severity'] = REQUIREMENT_ERROR;
    $requirements['ga_login']['value'] = t('Third-party libraries');
    $requirements['ga_login']['description'] = t("Please install the 'christian-riesen/otp' library via composer. See the module README for instructions.");
  }
  return $requirements;
}