You are here

function miniorange_2fa_inline_registration::send_otp_email_to_user 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::send_otp_email_to_user()
1 call to miniorange_2fa_inline_registration::send_otp_email_to_user()
miniorange_2fa_inline_registration::handle_page_one_submit in src/Form/miniorange_2fa_inline_registration.php

File

src/Form/miniorange_2fa_inline_registration.php, line 753

Class

miniorange_2fa_inline_registration

Namespace

Drupal\miniorange_2fa\form

Code

function send_otp_email_to_user($username) {
  $customer = new MiniorangeCustomerProfile();
  $miniorange_user = new MiniorangeUser($customer
    ->getCustomerID(), NULL, NULL, NULL, AuthenticationType::$EMAIL['code'], $username);
  $auth_api_handler = new AuthenticationAPIHandler($customer
    ->getCustomerID(), $customer
    ->getAPIKey());
  $response = $auth_api_handler
    ->challenge($miniorange_user);
  return $response;
}