function moAuthAddJS in Google Authenticator / 2 Factor Authentication - 2FA 7
1 call to moAuthAddJS()
File
- ./
mo_auth.module, line 575 - Module file for miniOrange 2FA Module.
Code
function moAuthAddJS(&$form, &$form_state, $attached = FALSE) {
// save data to JS
$loginSettings = new MoAuthLoginSettings();
if ($loginSettings
->getEnablePasswordChecks()) {
global $base_url;
$account = $form['#user'];
$fnameValue = getValueOfField($account, $loginSettings
->getMachineNameOfFname());
$lnameValue = getValueOfField($account, $loginSettings
->getMachineNameOfLname());
$moTfaJsSettings = array(
'mo_2fa' => array(
'enablePasswordCheck' => $loginSettings
->getEnablePasswordChecks(),
'uniquePassword' => $loginSettings
->getLastNUniquePassword(),
'passwordMinLength' => $loginSettings
->getPasswordMinLength(),
'passwordMaxLength' => $loginSettings
->getPasswordMaxLength(),
'passwordMustHaveLowChar' => $loginSettings
->getPasswordMustHaveLowChar(),
'passwordMustHaveUpChar' => $loginSettings
->getPasswordMustHaveUpChar(),
'passwordMustHaveNumChar' => $loginSettings
->getPasswordMustHaveNumChar(),
'passwordMustHaveSpecialChar' => $loginSettings
->getPasswordMustHaveSpecialChar(),
'passwordMustNotBeEmail' => $loginSettings
->getPasswordMustNotBeEmail(),
'passwordMustNotBeFirstName' => $loginSettings
->getPasswordMustNotBeFname(),
'passwordMustNotBeLastName' => $loginSettings
->getPasswordMustNotBeLname(),
'fname' => $fnameValue,
'lname' => $lnameValue,
'uniquePasswordUrl' => $base_url . '/mo_auth_checkpassword',
'ajaxCallId' => $account->uid,
),
);
if ($attached) {
$form['#attached']['js'][] = drupal_get_path('module', 'mo_auth') . '/includes/js/mo_auth_password.js';
}
else {
drupal_add_js(drupal_get_path('module', 'mo_auth') . '/includes/js/mo_auth_password.js', 'file');
}
$form['#attached']['js'][] = array(
'data' => $moTfaJsSettings,
'type' => 'setting',
);
// add php variables into Drupal JS settings
}
}