1
0
mirror of https://github.com/processwire/processwire.git synced 2025-08-17 20:11:46 +02:00

Minor updates to Tfa class

This commit is contained in:
Ryan Cramer
2020-06-26 09:39:41 -04:00
parent 735c118910
commit 26710f262e

View File

@@ -207,7 +207,7 @@ class Tfa extends WireData implements Module, ConfigurableModule {
* *
*/ */
public function init() { public function init() {
if($this->className() != 'Tfa') $this->initHooks(); $this->initHooks();
} }
/** /**
@@ -1192,10 +1192,14 @@ class Tfa extends WireData implements Module, ConfigurableModule {
* *
*/ */
protected function initHooks() { protected function initHooks() {
if($this->className() === 'Tfa') {
$this->addHookBefore('InputfieldForm::render', $this, 'hookInputfieldFormRender');
} else {
$this->addHookBefore('InputfieldForm::render', $this, 'hookInputfieldFormRender'); $this->addHookBefore('InputfieldForm::render', $this, 'hookInputfieldFormRender');
$this->addHookBefore('InputfieldForm::processInput', $this, 'hookBeforeInputfieldFormProcess'); $this->addHookBefore('InputfieldForm::processInput', $this, 'hookBeforeInputfieldFormProcess');
$this->addHookAfter('InputfieldForm::processInput', $this, 'hookAfterInputfieldFormProcess'); $this->addHookAfter('InputfieldForm::processInput', $this, 'hookAfterInputfieldFormProcess');
} }
}
/** /**
* Hook before InputfieldForm::processInput() * Hook before InputfieldForm::processInput()
@@ -1878,13 +1882,10 @@ class RememberTfa extends Wire {
$agent = isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : 'noagent'; $agent = isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : 'noagent';
if(isset($_SERVER['HTTP_X_FORWARDED_FOR'])) { $fwip = '';
$fwip = $_SERVER['HTTP_X_FORWARDED_FOR']; if(isset($_SERVER['HTTP_X_FORWARDED_FOR'])) $fwip .= $_SERVER['HTTP_X_FORWARDED_FOR'];
} else if(isset($_SERVER['HTTP_CLIENT_IP'])) { if(isset($_SERVER['HTTP_CLIENT_IP'])) $fwip .= ' ' . $_SERVER['HTTP_CLIENT_IP'];
$fwip = $_SERVER['HTTP_CLIENT_IP']; if(empty($fwip)) $fwip = 'nofwip';
} else {
$fwip = 'nofwip';
}
$fingerprints = array( $fingerprints = array(
'agent' => $agent, 'agent' => $agent,