You are here

public static function MoAuthUtilities::show_error_or_success_message in Google Authenticator / 2 Factor Authentication - 2FA 8

Same name and namespace in other branches
  1. 8.2 src/MoAuthUtilities.php \Drupal\miniorange_2fa\MoAuthUtilities::show_error_or_success_message()
22 calls to MoAuthUtilities::show_error_or_success_message()
configure_google_authenticator::submitForm in src/Form/configure_google_authenticator.php
Form submission handler.
configure_kba::submitForm in src/Form/configure_kba.php
Form submission handler.
configure_otp_over_email::miniorange_saml_validate_otp_submit in src/Form/configure_otp_over_email.php
configure_otp_over_phone::miniorange_saml_validate_otp_submit in src/Form/configure_otp_over_phone.php
configure_otp_over_sms::miniorange_saml_validate_otp_submit in src/Form/configure_otp_over_sms.php

... See full list

File

src/MoAuthUtilities.php, line 129
This file is part of miniOrange 2FA module.

Class

MoAuthUtilities

Namespace

Drupal\miniorange_2fa

Code

public static function show_error_or_success_message($message, $status) {
  global $base_url;
  $url = $base_url . '/admin/config/people/miniorange_2fa/setup_twofactor';
  \Drupal::configFactory()
    ->getEditable('miniorange_2fa.settings')
    ->set('mo_auth_2fa_Success/Error message', $message)
    ->save();
  \Drupal::configFactory()
    ->getEditable('miniorange_2fa.settings')
    ->set('mo_auth_2fa_Success/Error status', $status)
    ->save();
  $response = new TrustedRedirectResponse($url);
  $response
    ->send();
}