You are here

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

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

File

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

Code

function mo_auth_build_push_notifications_form($form, $base_url, $challenge_response) {
  $response = $_SESSION['mo_auth']['mo_challenge_response'];

  //$user_email = $challenge_response->emailDelivery->contact;

  //$hidden_email = MoAuthUtilities::getHiddenEmail($user_email);
  $message = t('Please accept the push notification sent to your miniOrange Authenticator App.');
  $form['#attached']['js'][] = array(
    'data' => array(
      'mo_authentication' => array(
        'txId' => $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">A Push Notification has been sent to your miniOrange Authenticator App.</div>
                  <div class="mo2f-info mo2f-text-center">We are waiting for your approval...</div>');
  $image_path = file_create_url($base_url . '/' . drupal_get_path('module', 'mo_auth') . '/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,
  );
  $submit_attributes = array(
    'class' => array(
      'element-invisible',
    ),
  );
  $form['submit_attributes'] = $submit_attributes;
  $form['mo_message'] = $message;
  return $form;
}