function miniorange_2fa_inline_registration::handle_page_three_submit in Google Authenticator / 2 Factor Authentication - 2FA 8.2
Same name and namespace in other branches
- 8 src/Form/miniorange_2fa_inline_registration.php \Drupal\miniorange_2fa\form\miniorange_2fa_inline_registration::handle_page_three_submit()
File
- src/
Form/ miniorange_2fa_inline_registration.php, line 425 - Page 1: Select Email address. Page 2: Verify OTP. Page 3: Select Auth Method. Page 4: Configure Auth Method. Page 5: Configure KBA.
Class
- miniorange_2fa_inline_registration
- @file Page 1: Select Email address. Page 2: Verify OTP. Page 3: Select Auth Method. Page 4: Configure Auth Method. Page 5: Configure KBA.
Namespace
Drupal\miniorange_2fa\formCode
function handle_page_three_submit(array $form, FormStateInterface &$form_state) {
$storage = $form_state
->getStorage();
if (!isset($storage['page_one_values'])) {
$utilities = new MoAuthUtilities();
$custom_attribute = $utilities::get_users_custom_attribute($this
->currentUser()
->id());
$storage['page_one_values']['mo_auth_user_email'] = $custom_attribute[0]->miniorange_registered_email;
$storage['page_one_values']['mo_2fa_new_user'] = FALSE;
$storage['page_one_values']['mo_2fa_reset'] = TRUE;
$storage['page_two_values'] = array();
}
$form_state
->setRebuild();
$method = $form['mo_auth_method']['#value'];
if ($method == AuthenticationType::$EMAIL_VERIFICATION['code'] || $method == AuthenticationType::$EMAIL['code']) {
// Go to Step 5 directly
$page = [
'page_five' => TRUE,
'page_three_values' => $form_state
->getValues(),
'page_two_values' => $storage['page_two_values'],
'page_one_values' => $storage['page_one_values'],
];
$form_state
->setStorage($page);
}
else {
$page = [
'page_four' => TRUE,
'page_three_values' => $form_state
->getValues(),
'page_two_values' => $storage['page_two_values'],
'page_one_values' => $storage['page_one_values'],
];
$_SESSION['message'] = '';
$_SESSION['success_status'] = TRUE;
$form_state
->setStorage($page);
}
}