Changeset View
Changeset View
Standalone View
Standalone View
src/app/Auth/SecondFactor.php
Show First 20 Lines • Show All 113 Lines • ▼ Show 20 Lines | class SecondFactor extends Base | ||||
* | * | ||||
* @param string $factor Factor identifier (<method>:<id>) | * @param string $factor Factor identifier (<method>:<id>) | ||||
* @param string $code Authentication code | * @param string $code Authentication code | ||||
* | * | ||||
* @return bool True on successful validation | * @return bool True on successful validation | ||||
*/ | */ | ||||
protected function verify($factor, $code): bool | protected function verify($factor, $code): bool | ||||
{ | { | ||||
if ($driver = $this->getDriver($factor)) { | $driver = $this->getDriver($factor); | ||||
return $driver->verify($code, time()); | return $driver->verify($code, time()); | ||||
} | } | ||||
return false; | |||||
} | |||||
/** | /** | ||||
* Load driver class for the given authentication factor | * Load driver class for the given authentication factor | ||||
* | * | ||||
* @param string $factor Factor identifier (<method>:<id>) | * @param string $factor Factor identifier (<method>:<id>) | ||||
* | * | ||||
* @return \Kolab2FA\Driver\Base | * @return \Kolab2FA\Driver\Base | ||||
*/ | */ | ||||
protected function getDriver(string $factor) | protected function getDriver(string $factor) | ||||
▲ Show 20 Lines • Show All 197 Lines • Show Last 20 Lines |