You are here

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

1 string reference to 'mo_auth_inline_registration'
mo_auth_menu in ./mo_auth.module
Implements hook_menu().

File

./mo_auth_inline_registration.inc, line 12

Code

function mo_auth_inline_registration($form, &$form_state, $user) {
  $mo2FAResetRequest = isset($_GET['mo2faresetrequest']) ? TRUE : FALSE;
  if (user_is_logged_in() && ($user->uid != $GLOBALS['user']->uid || !$mo2FAResetRequest)) {
    drupal_goto('user');
    exit;
  }
  $form_state['uid'] = $user->uid;
  if (empty($user->miniorange_registered_email) && isset($_SESSION['mo_auth']['1ST_FACTOR_AUTHENTICATED_FOR']) && $_SESSION['mo_auth']['1ST_FACTOR_AUTHENTICATED_FOR'] == $user->uid || $mo2FAResetRequest && user_is_logged_in()) {

    // Display page 5 if $form_state['storage']['page_five'] is set
    if (isset($form_state['storage']['page_five'])) {
      return mo_auth_inline_registration_page_five($form_state, TRUE);
    }
    elseif (isset($form_state['storage']['page_otp_validate'])) {
      return mo_auth_inline_registration_page_four_otp_validate($form_state);
    }
    elseif (isset($form_state['storage']['page_four'])) {
      return mo_auth_inline_registration_page_four($form_state);
    }
    elseif (isset($form_state['storage']['page_three']) || $mo2FAResetRequest && user_is_logged_in()) {
      return mo_auth_inline_registration_page_three();
    }
    elseif (isset($form_state['storage']['page_two'])) {

      // $email = $form_state['storage']['page_one_values']['mo_auth_user_email'];
      return mo_auth_inline_registration_page_two($form, $form_state);
    }
    else {
      return mo_auth_inline_registration_page_one(NULL, $user->mail);
    }
  }
}