function miniorange_2fa_inline_registration::handle_skip_mfa in Google Authenticator / 2 Factor Authentication - 2FA 8.2
File
- src/
Form/ miniorange_2fa_inline_registration.php, line 162 - 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_skip_mfa($form, FormStateInterface &$form_state) {
$session = MoAuthUtilities::getSession();
$moMfaSession = $session
->get('mo_auth');
$account = NULL;
$redirectUrl = Url::fromRoute('user.login')
->toString();
if (isset($moMfaSession['uid'])) {
$account = User::load($uid = $moMfaSession['uid']);
MoAuthUtilities::updateMfaSettingsForUser($account
->id(), 0);
user_login_finalize($account);
$this
->messenger()
->addWarning($this
->t("You have successfully disabled 2FA for your account. You can enable it anytime from here."));
$redirectUrl = Url::fromRoute('miniorange_2fa.user.mo_mfa_form', [
'user' => $account
->id(),
])
->toString();
}
$response = new RedirectResponse($redirectUrl);
$response
->send();
}