mirror of
https://github.com/Bubka/2FAuth.git
synced 2025-06-25 22:41:57 +02:00
Fix error when submitting null OTP parameters
This commit is contained in:
parent
52f9867fee
commit
72db88e9fa
@ -333,21 +333,22 @@ class TwoFAccountService
|
|||||||
try {
|
try {
|
||||||
if ( $dto->otp_type === 'totp' ) {
|
if ( $dto->otp_type === 'totp' ) {
|
||||||
$this->token = TOTP::create(
|
$this->token = TOTP::create(
|
||||||
$dto->secret,
|
$dto->secret
|
||||||
$dto->period,
|
|
||||||
$dto->algorithm,
|
|
||||||
$dto->digits,
|
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if ($dto->period) $this->token->setParameter('period', $dto->period);
|
||||||
}
|
}
|
||||||
else if ( $dto->otp_type === 'hotp' ) {
|
else if ( $dto->otp_type === 'hotp' ) {
|
||||||
$this->token = HOTP::create(
|
$this->token = HOTP::create(
|
||||||
$dto->secret,
|
$dto->secret
|
||||||
$dto->counter,
|
|
||||||
$dto->algorithm,
|
|
||||||
$dto->digits,
|
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if ($dto->counter) $this->token->setParameter('counter', $dto->counter);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($dto->algorithm) $this->token->setParameter('digest', $dto->algorithm);
|
||||||
|
if ($dto->digits) $this->token->setParameter('digits', $dto->digits);
|
||||||
|
// if ($dto->epoch) $this->token->setParameter('epoch', $dto->epoch);
|
||||||
if ($dto->service) $this->token->setIssuer($dto->service);
|
if ($dto->service) $this->token->setIssuer($dto->service);
|
||||||
if ($dto->account) $this->token->setLabel($dto->account);
|
if ($dto->account) $this->token->setLabel($dto->account);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user