You are here

function mo_auth_build_qrcode_authentication_form in Google Authenticator / 2 Factor Authentication - 2FA 7

1 call to mo_auth_build_qrcode_authentication_form()
mo_auth_build_form_content in ./authenticate_user.inc

File

./authenticate_user.inc, line 326
This is used to authenticate user during login.

Code

function mo_auth_build_qrcode_authentication_form($form, $base_url, $challenge_response) {
  $message = t('Please scan the below QR Code from miniOrange Authenticator app.');
  $form['#attached']['js'][] = array(
    'data' => array(
      'mo_authentication' => array(
        'txId' => $challenge_response->txId,
        'url' => MoAuthConstants::getBaseUrl() . MoAuthConstants::$AUTH_STATUS_API,
      ),
    ),
    'type' => 'setting',
  );
  $form['header']['#markup'] .= t('<div class="mo2f-message mo2f-message-status">' . $message . '</div>');
  $form['header']['#markup'] .= t('<div class="mo2f-info mo2f-text-center">Please scan the below QR Code with miniOrange Authenticator app to authenticate yourself.</div>');
  $form['header']['#markup'] .= '<div class="mo2f-text-center"><img class="mo2f_image" src="data:image/jpg;base64,' . $challenge_response->qrCode . '"></div>';
  $form['txId'] = array(
    '#type' => 'hidden',
    '#value' => $challenge_response->txId,
  );
  $submit_attributes = array(
    'class' => array(
      'element-invisible',
    ),
  );
  $form['submit_attributes'] = $submit_attributes;
  $form['mo_message'] = $message;
  return $form;
}