You are here

function miniorange_2fa_inline_registration::mo_auth_inline_registration_page_one in Google Authenticator / 2 Factor Authentication - 2FA 8

Same name and namespace in other branches
  1. 8.2 src/Form/miniorange_2fa_inline_registration.php \Drupal\miniorange_2fa\form\miniorange_2fa_inline_registration::mo_auth_inline_registration_page_one()
1 call to miniorange_2fa_inline_registration::mo_auth_inline_registration_page_one()
miniorange_2fa_inline_registration::buildForm in src/Form/miniorange_2fa_inline_registration.php
Form constructor.

File

src/Form/miniorange_2fa_inline_registration.php, line 80

Class

miniorange_2fa_inline_registration

Namespace

Drupal\miniorange_2fa\form

Code

function mo_auth_inline_registration_page_one($form, $form_state, $success_status, $user_email) {
  $prefix = '<div class="mo2f-modal">
              <div class="mo2f-modal-content">
              <div class="mo2f-modal-container mo2f-modal-header">Register (Step 1/5)</div>
              <div class="mo2f-modal-container">';
  if ($success_status === FALSE) {
    if (isset($_SESSION['message'])) {
      $message = $_SESSION['message'];
      $prefix .= '<div class="mo2f-message mo2f-message-error">' . $message . '</div>';
    }
    else {
      $message = 'This email is already in use. Please try another email.';
      $prefix .= '<div class="mo2f-message mo2f-message-error">' . $message . '</div>';
    }
    unset($_SESSION['message']);
    $_SESSION['success_status'] = TRUE;
  }
  $prefix .= '<div class="mo2f-info mo2f-text-center">
  		A new security system has been enabled to better protect your account. Please configure
  		your Two-Factor Authentication method by setting up your account</div>
  		<div class="mo2f-text-center">';
  $sufix = '</div></div><div class="mo2f-modal-container mo2f-modal-footer">';
  $form['mo_auth_user_email'] = array(
    '#type' => 'textfield',
    '#default_value' => $user_email,
    '#attributes' => array(
      'placeholder' => 'person@example.com',
      'class' => array(
        'mo2f_email_textbox',
      ),
    ),
    '#prefix' => $prefix,
    '#suffix' => $sufix,
  );
  $form['actions'] = array(
    '#type' => 'actions',
  );
  $form['actions']['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Get Started'),
    '#submit' => array(
      '::handle_page_one_submit',
    ),
  );
  $form['actions']['cancel'] = array(
    '#type' => 'submit',
    '#value' => t('Cancel'),
    '#submit' => array(
      '::handle_page_cancel',
    ),
  );
  return $form;
}