function mo_auth_customer_setup in Google Authenticator / 2 Factor Authentication - 2FA 7
Customer setup form().
1 string reference to 'mo_auth_customer_setup'
- mo_auth_menu in ./
mo_auth.module - Implements hook_menu().
File
- ./
mo_auth_customer_setup.inc, line 11 - Contains form for customer setup.
Code
function mo_auth_customer_setup($form, &$form_state) {
global $user;
$user_obj = user_load($user->uid);
$current_status = variable_get('mo_auth_status', '');
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,
));
if ($current_status == 'VALIDATE_OTP') {
$form['header_top_style_2'] = array(
'#markup' => '<div class="mo2f_table_layout_1"><div class="mo2f_table_layout mo2f_container">',
);
$form['mo_auth_customer_otp_token'] = array(
'#type' => 'textfield',
'#title' => t('Please enter the OTP you received<span style="color: red">*</span>'),
'#attributes' => array(
'autofocus' => 'true',
),
);
$form['mo_auth_customer_validate_otp_button'] = array(
'#type' => 'submit',
'#value' => t('Validate OTP'),
'#submit' => array(
'mo_auth_validate_otp_submit',
),
);
$form['mo_auth_customer_setup_resendotp'] = array(
'#type' => 'submit',
'#value' => t('Resend OTP'),
'#submit' => array(
'mo_auth_resend_otp',
),
);
$form['mo_auth_customer_setup_back'] = array(
'#type' => 'submit',
'#value' => t('Back'),
'#submit' => array(
'mo_auth_back',
),
);
$form['markup_idp_attr_header_top_div_close'] = array(
'#markup' => '<br><br><br><br><br><br><br><br><br><br><br><br></div>',
);
MoAuthUtilities::addSupportForm($form, $form_state);
return $form;
}
elseif ($current_status == 'PLUGIN_CONFIGURATION') {
// Show customer configuration here.
$user_email = $user_obj->miniorange_registered_email[LANGUAGE_NONE][0]['value'];
$customer = new MiniorangeCustomerProfile();
$user_api_handler = new UsersAPIHandler($customer
->getCustomerID(), $customer
->getAPIKey());
$miniorange_user = new MiniorangeUser($customer
->getCustomerID(), $user_email, '', '', '');
$response = $user_api_handler
->get($miniorange_user);
$authType = !is_null($response) ? AuthenticationType::getAuthType($response->authType) : NULL;
$form['header_top_style_2'] = array(
'#markup' => '<div class="mo2f_table_layout_1"><div class="mo2f_table_layout mo2f_container">',
);
$form['markup_saml_idp_regsitration_message'] = array(
'#markup' => '<div style="display:block;margin-top:10px;text-align: center;font-size: 15px;color:rgba(0, 128, 0, 0.80);background-color:rgba(0, 255, 0, 0.15);padding:5px;">
Thank you for registering with miniOrange
</div></br>',
);
$header = array(
'attribute' => array(
'data' => t('Attribute'),
),
'value' => array(
'data' => t('Value'),
),
);
$options = array();
$options[0] = array(
'attribute' => '2 Factor Registered Email',
'value' => variable_get('mo_auth_customer_admin_email', ''),
);
$options[1] = array(
'attribute' => 'Activated 2nd Factor',
'value' => $authType['name'],
);
$options[2] = array(
'attribute' => 'Xecurify Registered Email',
'value' => $user_email,
);
$options[3] = array(
'attribute' => 'Customer ID',
'value' => variable_get('mo_auth_customer_id', ''),
);
$options[4] = array(
'attribute' => 'API Key',
'value' => variable_get('mo_auth_customer_api_key', ''),
);
$options[5] = array(
'attribute' => 'Token Key',
'value' => variable_get('mo_auth_customer_token_key', ''),
);
$options[6] = array(
'attribute' => 'App Secret',
'value' => variable_get('mo_auth_customer_app_secret', ''),
);
$form['fieldset']['customerinfo'] = array(
'#theme' => 'table',
'#header' => $header,
'#rows' => $options,
);
$license_header = array(
'attribute' => array(
'data' => t('Attribute'),
),
'value' => array(
'data' => t('Value'),
),
);
$license_options = array();
$license_options[0] = array(
'attribute' => 'License Type',
'value' => variable_get('mo_auth_2fa_license_type', 'DEMO'),
);
$license_options[1] = array(
'attribute' => 'License Plan',
'value' => variable_get('mo_auth_2fa_license_plan', 'DEMO'),
);
$license_options[2] = array(
'attribute' => 'No. of Users',
'value' => variable_get('mo_auth_2fa_license_no_of_users', 1),
);
$license_options[3] = array(
'attribute' => 'SMS Remaining',
'value' => variable_get('mo_auth_2fa_sms_remaining', '-'),
);
$license_options[4] = array(
'attribute' => 'Email Remaining',
'value' => variable_get('mo_auth_2fa_email_remaining', '-'),
);
$license_options[5] = array(
'attribute' => 'License Expiry',
'value' => variable_get('mo_auth_2fa_license_expiry', '-'),
);
$license_options[6] = array(
'attribute' => 'Support Expiry',
'value' => variable_get('mo_auth_2fa_support_expiry', '-'),
);
$form['fieldset']['customer-license'] = array(
'#theme' => 'table',
'#header' => $license_header,
'#rows' => $license_options,
'#prefix' => '<div style="margin-top: 20px;"><h4>Your license info: </h4></div>',
);
$form['fecth_customer_license'] = array(
'#type' => 'submit',
'#value' => t('Check License'),
'#submit' => array(
'mo_auth_fetch_customer_license',
),
);
$form['remove_customer_account'] = array(
'#type' => 'submit',
'#value' => t('Remove Account'),
'#submit' => array(
'mo_auth_remove_customer_account',
),
'#attributes' => array(
'style' => 'margin-left: 10%;',
),
'#suffix' => '</div>',
);
MoAuthUtilities::addSupportForm($form, $form_state);
return $form;
}
$form['header_top_style_2'] = array(
'#markup' => '<div class="mo2f_table_layout_1"><div class="mo2f_table_layout mo2f_container">',
);
$form['markup_14'] = array(
'#markup' => '<h3>Register/Login with miniOrange</br></br><hr></h3>',
);
$form['markup_15'] = array(
'#markup' => '<div class="mo2f_highlight_background_note">Just complete the short registration below to configure the Two-Factor Module.
Please enter a valid email ID that you have access to.
You will be able to move forward after verifying an OTP that we will send to this email.
</div></br>',
);
$form['mo_auth_customer_setup_username'] = array(
'#type' => 'textfield',
'#title' => t('Email<span class = "mo2f_red_color_star">*</span>'),
'#attributes' => array(
'autofocus' => 'true',
),
);
$form['mo_auth_customer_setup_phone'] = array(
'#type' => 'textfield',
'#title' => t('Phone'),
'#id' => 'query_phone',
'#attributes' => array(
'class' => array(
'query_phone',
),
),
'#description' => t('<strong>Note:</strong> Enter your phone number with country code (eg. +1xxxxxx )'),
);
$form['mo_auth_customer_setup_password'] = array(
'#type' => 'password_confirm',
'#description' => t('<strong>Note:</strong> Enter your password with minimum length of 6.'),
);
$form['mo_auth_customer_setup_button'] = array(
'#type' => 'submit',
'#value' => t('Submit'),
'#submit' => array(
'mo_auth_customer_setup_submit',
),
);
$form['markup_idp_attr_header_top_support_5'] = array(
'#markup' => '</div>',
);
MoAuthUtilities::addSupportForm($form, $form_state);
return $form;
}