mirror of
https://git.code.sf.net/p/seeddms/code
synced 2025-05-11 20:21:16 +00:00
check code from google authenticator
This commit is contained in:
parent
b8b1996fb4
commit
b5b9a5eac3
|
@ -227,6 +227,23 @@ if (is_bool($user)) {
|
|||
exit;
|
||||
}
|
||||
|
||||
if($settings->_enable2FactorAuthentication) {
|
||||
if($secret = $user->getSecret()) {
|
||||
require "vendor/robthree/twofactorauth/lib/Providers/Qr/IQRCodeProvider.php";
|
||||
require "vendor/robthree/twofactorauth/lib/Providers/Qr/BaseHTTPQRCodeProvider.php";
|
||||
require "vendor/robthree/twofactorauth/lib/Providers/Qr/GoogleQRCodeProvider.php";
|
||||
require "vendor/robthree/twofactorauth/lib/Providers/Rng/IRNGProvider.php";
|
||||
require "vendor/robthree/twofactorauth/lib/Providers/Rng/MCryptRNGProvider.php";
|
||||
require "vendor/robthree/twofactorauth/lib/TwoFactorAuthException.php";
|
||||
require "vendor/robthree/twofactorauth/lib/TwoFactorAuth.php";
|
||||
$tfa = new \RobThree\Auth\TwoFactorAuth('SeedDMS');
|
||||
if($tfa->verifyCode($secret, $_POST['twofactauth']) !== true) {
|
||||
_printMessage(getMLText("login_error_title"), getMLText("login_error_text"));
|
||||
exit;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Clear login failures if login was successful */
|
||||
$user->clearLoginFailures();
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user