function mo_auth_configure_otp_over_sms in Google Authenticator / 2 Factor Authentication - 2FA 7
1 string reference to 'mo_auth_configure_otp_over_sms'
- mo_auth_menu in ./
mo_auth.module - Implements hook_menu().
File
- ./
configure_otp_over_sms.inc, line 3
Code
function mo_auth_configure_otp_over_sms($form, &$form_state) {
drupal_add_js(drupal_get_path('module', 'mo_auth') . '/includes/js/Phone.js', 'file');
drupal_add_css(drupal_get_path('module', 'mo_auth') . '/includes/css/phone.css', array(
'group' => CSS_DEFAULT,
'every_page' => FALSE,
));
global $base_url, $user;
$user = user_load($user->uid);
$query_param = $_GET["q"];
$url_parts = explode('/', $query_param);
$authTypeCode = '';
$messageHeader = '';
if (in_array("otp-over-sms", $url_parts)) {
$authTypeCode = AuthenticationType::$SMS['code'];
$messageHeader = 'Configure OTP Over SMS';
$methodName = 'OTP Over SMS';
}
elseif (in_array("otp-over-email", $url_parts)) {
$authTypeCode = AuthenticationType::$OTP_OVER_EMAIL['code'];
$messageHeader = 'Configure OTP Over Email';
$methodName = 'OTP Over Email';
}
elseif (in_array("otp-over-phone", $url_parts)) {
$authTypeCode = AuthenticationType::$OTP_OVER_PHONE['code'];
$messageHeader = 'Configure OTP Over Phone call';
$methodName = 'OTP Over Phone call';
}
$user_email = $user->miniorange_registered_email[LANGUAGE_NONE][0]['value'];
$customer = new MiniorangeCustomerProfile();
$miniorange_user = new MiniorangeUser($customer
->getCustomerID(), $user_email, NULL, NULL, $authTypeCode);
$auth_api_handler = new AuthenticationAPIHandler($customer
->getCustomerID(), $customer
->getAPIKey());
$mo_note = t('<ul><li>Customize SMS/Email template.</li> <li>Customize OTP Length and Validity.</li><li>For customization goto <a href="' . $base_url . '/admin/config/people/mo_auth/login_settings">Login Settings</a> tab and navigate to <u>CUSTOMIZE SMS AND EMAIL TEMPLATE</u> section.</li></ul>');
$form['header']['#markup'] = '<div class="mo2f-setup-header"><div class="mo2f-setup-header-top-left">' . $messageHeader . '</div></div>';
$form['mo_2fa_custom_note'] = array(
'#markup' => t('<br><div class="mo2f_highlight_background_note"><strong>You can customize the following things of the ' . $methodName . ' method:</strong>' . $mo_note . '</div><br>'),
);
if ($methodName == 'OTP Over Email') {
$form['miniorange_email'] = array(
'#type' => 'textfield',
'#title' => t('Verify Your Email*'),
'#value' => $user_email,
'#disabled' => TRUE,
);
}
else {
$form['miniorange_phone'] = array(
'#type' => 'textfield',
'#title' => t('Verify Your Phone'),
'#id' => 'query_phone',
'#attributes' => array(
'class' => array(
'query_phone',
),
'pattern' => '[\\+][0-9]{1,4}\\s?[0-9]{7,12}',
),
'#description' => t('<strong>Note: </strong>Enter your phone number with country code (+1)'),
);
}
$form['verifyphone'] = array(
'#type' => 'submit',
'#value' => t('Verify'),
'#submit' => array(
'mo_auth_configure_otp_over_sms_submit',
),
);
$form['mo_authTypeCode'] = array(
'#type' => 'hidden',
'#value' => $authTypeCode,
);
$form['miniorange_saml_customer_setup_resendotp'] = array(
'#type' => 'submit',
'#value' => t('Resend OTP'),
'#submit' => array(
'mo_auth_configure_otp_over_sms_submit',
),
);
$form['miniorange_OTP'] = array(
'#type' => 'textfield',
'#title' => t('OTP'),
);
$form['miniorange_saml_customer_validate_otp_button'] = array(
'#type' => 'submit',
'#value' => t('Validate OTP'),
'#submit' => array(
'miniorange_saml_validate_otp_submit',
),
);
$form['actions']['cancel'] = array(
'#markup' => l(t('Back'), 'admin/config/people/mo_auth/setup'),
);
return $form;
}