You are here

function authenticate_user::mo_auth_build_push_notifications_form in Google Authenticator / 2 Factor Authentication - 2FA 8.2

Same name and namespace in other branches
  1. 8 src/Form/authenticate_user.php \Drupal\miniorange_2fa\form\authenticate_user::mo_auth_build_push_notifications_form()
1 call to authenticate_user::mo_auth_build_push_notifications_form()
authenticate_user::mo_auth_build_form_content in src/Form/authenticate_user.php

File

src/Form/authenticate_user.php, line 552
This is used to authenticate user during login.

Class

authenticate_user
@file This is used to authenticate user during login.

Namespace

Drupal\miniorange_2fa\form

Code

function mo_auth_build_push_notifications_form($form, $base_url) {
  $session = MoAuthUtilities::getSession();
  $moMfaSession = $session
    ->get("mo_auth", null);
  $response = $moMfaSession['mo_challenge_response'];
  $message = t('Please accept the push notification sent to your miniOrange Authenticator App.');
  $form['header']['#markup'] .= t('<div class="mo2f-message mo2f-message-status">' . $message . '</div>');
  $form['header']['#markup'] .= '<div class="mo2f-info mo2f-text-center">' . t('A Push Notification has been sent to your miniOrange Authenticator App.') . '</div>
                  <div class="mo2f-info mo2f-text-center">' . t('We are waiting for your approval...') . '</div>';
  $image_path = file_create_url($base_url . '/' . drupal_get_path('module', 'miniorange_2fa') . '/includes/images/ajax-loader-login.gif');
  $form['header']['#markup'] .= '<div class="mo2f-text-center"><img class="mo2f_image" src="' . $image_path . '"></div>';
  $form['txId'] = array(
    '#type' => 'hidden',
    '#value' => $response->txId,
  );
  $form['url'] = array(
    '#type' => 'hidden',
    '#value' => MoAuthConstants::getBaseUrl() . MoAuthConstants::$AUTH_STATUS_API,
  );
  $form['mo_message'] = $message;
  return $form;
}