You are here

public static function AuthenticationType::getAuthType in Google Authenticator / 2 Factor Authentication - 2FA 8

Same name and namespace in other branches
  1. 8.2 src/AuthenticationType.php \Drupal\miniorange_2fa\AuthenticationType::getAuthType()
5 calls to AuthenticationType::getAuthType()
authenticate_user::buildForm in src/Form/authenticate_user.php
Form constructor.
authenticate_user::mo_auth_authenticate_user_submit in src/Form/authenticate_user.php
authenticate_user::mo_auth_forgot_phone in src/Form/authenticate_user.php
MoAuthCustomerSetup::buildForm in src/Form/MoAuthCustomerSetup.php
Form constructor.
MoAuthSetupTwoFactor::buildForm in src/Form/MoAuthSetupTwoFactor.php
Form constructor.

File

src/AuthenticationType.php, line 147
Contains Authentication type class.

Class

AuthenticationType
@file This class represents authentication type.

Namespace

Drupal\miniorange_2fa

Code

public static function getAuthType($code) {
  $arr = array(
    "SMS_AND_EMAIL" => AuthenticationType::$SMS_AND_EMAIL,
    "OTP_OVER_EMAIL" => AuthenticationType::$OTP_OVER_EMAIL,
    "EMAIL" => AuthenticationType::$EMAIL,
    "SMS" => AuthenticationType::$SMS,
    "EMAIL_VERIFICATION" => AuthenticationType::$EMAIL_VERIFICATION,
    "GOOGLE_AUTHENTICATOR" => AuthenticationType::$GOOGLE_AUTHENTICATOR,
    "QR_CODE" => AuthenticationType::$QR_CODE,
    "KBA" => AuthenticationType::$KBA,
    "SOFT_TOKEN" => AuthenticationType::$SOFT_TOKEN,
    "PUSH_NOTIFICATIONS" => AuthenticationType::$PUSH_NOTIFICATIONS,
    "PHONE_VERIFICATION" => AuthenticationType::$OTP_OVER_PHONE,
  );
  foreach ($arr as $authType) {
    if (strcasecmp($authType['code'], $code) == 0) {
      return $authType;
    }
  }
  return NULL;
}