mirror of
				https://github.com/getgrav/grav-plugin-admin.git
				synced 2025-10-30 09:56:11 +01:00 
			
		
		
		
	Fixed passing null to $twoFa->verifyCode() and $twoFa->verifyYubikeyOTP()
				
					
				
			`
This commit is contained in:
		| @@ -275,15 +275,16 @@ class LoginController extends AdminController | |||||||
|             $twoFa = null; |             $twoFa = null; | ||||||
|         } |         } | ||||||
|  |  | ||||||
|         $code = $data['2fa_code'] ?? null; |         $code = $data['2fa_code'] ?? ''; | ||||||
|         $secret = $user->twofa_secret ?? null; |         $secret = $user->twofa_secret ?? ''; | ||||||
|         $redirect = (string)$this->getRequest()->getUri(); |  | ||||||
|         $twofa_valid = $twoFa->verifyCode($secret, $code); |         $twofa_valid = $twoFa->verifyCode($secret, $code); | ||||||
|  |  | ||||||
|         $yubikey_otp = $data['yubikey_otp'] ?? null; |         $yubikey_otp = $data['yubikey_otp'] ?? ''; | ||||||
|         $yubikey_id = $user->yubikey_id ?? null; |         $yubikey_id = $user->yubikey_id ?? ''; | ||||||
|         $yubikey_valid = $twoFa->verifyYubikeyOTP($yubikey_id, $yubikey_otp); |         $yubikey_valid = $twoFa->verifyYubikeyOTP($yubikey_id, $yubikey_otp); | ||||||
|  |  | ||||||
|  |         $redirect = (string)$this->getRequest()->getUri(); | ||||||
|  |  | ||||||
|         if (null === $twoFa || !$user->authenticated || (!$twofa_valid && !$yubikey_valid) ) { |         if (null === $twoFa || !$user->authenticated || (!$twofa_valid && !$yubikey_valid) ) { | ||||||
|             Admin::DEBUG && Admin::addDebugMessage('Admin login: 2FA check failed, log out!'); |             Admin::DEBUG && Admin::addDebugMessage('Admin login: 2FA check failed, log out!'); | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user