You are here

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

Resend OTP.

1 string reference to 'mo_auth_resend_otp'
mo_auth_customer_setup in ./mo_auth_customer_setup.inc
Customer setup form().

File

./mo_auth_customer_setup.inc, line 303
Contains form for customer setup.

Code

function mo_auth_resend_otp(&$form, $form_state) {
  variable_del('mo_auth_tx_id');
  $username = variable_get('mo_auth_customer_admin_email', NULL);
  $phone = variable_get('mo_auth_customer_admin_phone', NULL);
  $customer_config = new MiniorangeCustomerSetup($username, $phone, NULL, NULL);
  $send_otp_response = $customer_config
    ->sendOtp();
  if ($send_otp_response->status == 'SUCCESS') {

    // Store txID.
    variable_set('mo_auth_tx_id', $send_otp_response->txId);
    $current_status = 'VALIDATE_OTP';
    variable_set('mo_auth_status', $current_status);
    drupal_set_message(t('We have resend an OTP to @username. Please enter the OTP to verify your email.', array(
      '@username' => $username,
    )));
  }
  else {
    variable_del('mo_auth_status');
    drupal_set_message(t('There was an error sending OTP to @username. Please try after some time or contact us at <a href="mailto:info@xecurify.com">info@xecurify.com</a>.', array(
      '@username' => $username,
    )), 'error');
  }
}