mirror of
https://github.com/Bubka/2FAuth.git
synced 2024-11-23 00:33:18 +01:00
Fix error when submitting null OTP parameters
This commit is contained in:
parent
52f9867fee
commit
72db88e9fa
@ -333,21 +333,22 @@ private function initTokenWithParameters(TwoFAccountDto $dto) : void
|
||||
try {
|
||||
if ( $dto->otp_type === 'totp' ) {
|
||||
$this->token = TOTP::create(
|
||||
$dto->secret,
|
||||
$dto->period,
|
||||
$dto->algorithm,
|
||||
$dto->digits,
|
||||
$dto->secret
|
||||
);
|
||||
|
||||
if ($dto->period) $this->token->setParameter('period', $dto->period);
|
||||
}
|
||||
else if ( $dto->otp_type === 'hotp' ) {
|
||||
$this->token = HOTP::create(
|
||||
$dto->secret,
|
||||
$dto->counter,
|
||||
$dto->algorithm,
|
||||
$dto->digits,
|
||||
$dto->secret
|
||||
);
|
||||
|
||||
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->account) $this->token->setLabel($dto->account);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user