public function TfaTrustedBrowserSetup::submitSetupForm in TFA Basic plugins 7
@copydoc TfaSetupPluginInterface::submitSetupForm()
Overrides TfaSetupPluginInterface::submitSetupForm
File
- includes/
tfa_trusted_browser.inc, line 297 - classes for TFA basic plugin
Class
- TfaTrustedBrowserSetup
- Class TfaTrustedBrowserSetup
Code
public function submitSetupForm(array $form, array &$form_state) {
if (isset($form_state['values']['existing'])) {
$count = 0;
foreach ($form_state['values']['existing'] as $element => $value) {
$id = str_replace('trusted_browser_', '', $element);
if (!$value) {
$this
->deleteTrusted($id);
$count++;
}
}
if ($count) {
watchdog('tfa_basic', 'Removed !num TFA trusted browsers during trusted browser setup', array(
'!num' => $count,
), WATCHDOG_INFO);
}
}
if (!empty($form_state['values']['trust']) && $form_state['values']['trust']) {
$name = '';
if (!empty($form_state['values']['name'])) {
$name = $form_state['values']['name'];
}
elseif (isset($_SERVER['HTTP_USER_AGENT'])) {
$name = $this
->getAgent();
}
$this
->setTrusted($this
->generateBrowserId(), $name);
}
return TRUE;
}