Fix empty secret after running fillWithOtpParameters()

This commit is contained in:
Bubka 2022-10-10 13:02:36 +02:00
parent a47975c46e
commit 7c924126a3

View File

@ -373,6 +373,10 @@ public function fillWithOtpParameters(array $parameters, bool $skipIconFetching
$this->counter = Arr::get($parameters, 'counter', $this->otp_type == self::HOTP ? self::DEFAULT_COUNTER : null);
$this->initGenerator();
// The generator could have been initialized without a secret, in that case it generates one on the fly.
// The secret attribute has thus to be updated
$this->secret = $this->secret ?: $this->generator->getSecret();
if ($this->otp_type === self::STEAM_TOTP || strtolower($this->service) === 'steam') {
$this->enforceAsSteam();