You are here

public static function MoAuthUtilities::mo_get_kba_questions in Google Authenticator / 2 Factor Authentication - 2FA 8.2

Parameters

string $question_set - which question set needs to be return:

string $type = return type:

Return value

array - Question set

2 calls to MoAuthUtilities::mo_get_kba_questions()
miniorange_2fa_inline_registration::mo_auth_get_kba_authentication_form in src/Form/miniorange_2fa_inline_registration.php
miniorange_2fa_inline_registration::mo_auth_inline_registration_page_five in src/Form/miniorange_2fa_inline_registration.php

File

src/MoAuthUtilities.php, line 172
This file is part of miniOrange 2FA module.

Class

MoAuthUtilities

Namespace

Drupal\miniorange_2fa

Code

public static function mo_get_kba_questions($question_set = 'ONE', $type = 'ARRAY') {
  $variables_and_values = array(
    'mo_auth_enable_custom_kba_questions',
    'mo_auth_custom_kba_set_1',
    'mo_auth_custom_kba_set_2',
  );
  $mo_db_values = self::miniOrange_set_get_configurations($variables_and_values, 'GET');
  if ($mo_db_values['mo_auth_enable_custom_kba_questions'] === FALSE || $mo_db_values['mo_auth_enable_custom_kba_questions'] == NULL || $mo_db_values['mo_auth_custom_kba_set_1'] == '' && $mo_db_values['mo_auth_custom_kba_set_2'] == '') {
    $question_set_one_string = 'What is your first company name?;What was your childhood nickname?;In what city did you meet your spouse/significant other?;What is the name of your favorite childhood friend?;What school did you attend for sixth grade?';
    $question_set_two_string = 'In what city or town was your first job?;What is your favorite sport?;Who is your favorite sports player?;What is your grandmothers maiden name?;What was your first vehicles registration number?';
  }
  else {
    $question_set_one_string = $mo_db_values['mo_auth_custom_kba_set_1'];
    $question_set_two_string = $mo_db_values['mo_auth_custom_kba_set_2'];
  }
  if ($question_set === 'ONE') {

    /** If type == STRING then send unprocessed string to show in the textarea ( login Settings Tab ) **/
    return $type === 'STRING' ? $question_set_one_string : self::get_kba_array($question_set_one_string);
  }

  /** If type == STRING then send unprocessed string to show in the textarea ( login Settings Tab ) **/
  return $type === 'STRING' ? $question_set_two_string : self::get_kba_array($question_set_two_string);
}