You are here

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

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

File

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

Code

function mo_auth_build_oobemail_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('A verification email is sent to <b class="mo2f_bold">' . $hidden_email . '</b>. Please click on accept link to verify your email.');
  $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 verification email is sent to your registered email.</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;
}