You are here

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

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

File

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

Code

function mo_auth_build_otp_over_email_form($form, $base_url, $challenge_response, $success_message = TRUE) {
  if ($success_message === TRUE) {
    $message = t('Please enter the one time passcode (OTP) sent to your  email.');
  }
  else {
    $message = t('The OTP you have entered is incorrect. Please enter the valid  OTP.');
  }
  $message_div_class = $success_message === TRUE ? 'mo2f-message-status' : 'mo2f-message-error';
  $form['header']['#markup'] .= t('<div class="mo2f-message ' . $message_div_class . '">' . $message . '</div>');
  $form['token'] = array(
    '#type' => 'textfield',
    '#title' => t('Please enter the passcode you received:'),
    '#attributes' => array(
      'autofocus' => 'true',
    ),
  );
  $submit_attributes = array();
  $form['submit_attributes'] = $submit_attributes;
  $form['mo_message'] = $message;
  return $form;
}