Fix #126 - Save updated HOTP counter after an OTP generation

This commit is contained in:
Bubka 2022-09-14 16:37:58 +02:00
parent b44c6958e3
commit b5c6f8f406
2 changed files with 7 additions and 0 deletions

View File

@ -321,6 +321,11 @@ public function getOTP()
$counter = $this->generator->getParameter('counter');
$OtpDto->password = $this->generator->at($counter);
$OtpDto->counter = $this->counter = $counter + 1;
// The updated HOTP counter must be saved to db for persisted account only
if ($this->id) {
$this->save();
}
}
else {

View File

@ -255,6 +255,8 @@
getHOTP: async function() {
let otp = await this.getOtp()
this.internal_password = otp.password
this.internal_counter = otp.counter
// returned counter & uri are incremented
this.$emit('increment-hotp', { nextHotpCounter: otp.counter, nextUri: otp.uri })