Commit 865b2731 authored by Franco Fichtner's avatar Franco Fichtner

Auth: small tweak for previous makes it easier to read

parent 20ec899a
......@@ -154,13 +154,14 @@ trait TOTP
if ($userObject != null && !empty($userObject->otp_seed)) {
if (strlen($password) > $this->otpLength) {
// split otp token code and userpassword
$pwLength = strlen($password) - $this->otpLength;
$pwStart = $this->otpLength;
$otpStart = 0;
if ($this->passwordFirst) {
$otpStart = strlen($password) - $this->otpLength;
$otpStart = $pwLength;
$pwStart = 0;
}
$userPassword = substr($password, $pwStart, strlen($password) - $this->otpLength);
$userPassword = substr($password, $pwStart, $pwLength);
$code = substr($password, $otpStart, $this->otpLength);
$otp_seed = \Base32\Base32::decode($userObject->otp_seed);
if ($this->authTOTP($otp_seed, $code)) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment