mirror of
https://github.com/Bubka/2FAuth.git
synced 2025-06-20 19:57:44 +02:00
Fix #126 - Save updated HOTP counter after an OTP generation
This commit is contained in:
parent
b44c6958e3
commit
b5c6f8f406
@ -321,6 +321,11 @@ class TwoFAccount extends Model implements Sortable
|
|||||||
$counter = $this->generator->getParameter('counter');
|
$counter = $this->generator->getParameter('counter');
|
||||||
$OtpDto->password = $this->generator->at($counter);
|
$OtpDto->password = $this->generator->at($counter);
|
||||||
$OtpDto->counter = $this->counter = $counter + 1;
|
$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 {
|
else {
|
||||||
|
|
||||||
|
@ -255,6 +255,8 @@
|
|||||||
getHOTP: async function() {
|
getHOTP: async function() {
|
||||||
|
|
||||||
let otp = await this.getOtp()
|
let otp = await this.getOtp()
|
||||||
|
this.internal_password = otp.password
|
||||||
|
this.internal_counter = otp.counter
|
||||||
|
|
||||||
// returned counter & uri are incremented
|
// returned counter & uri are incremented
|
||||||
this.$emit('increment-hotp', { nextHotpCounter: otp.counter, nextUri: otp.uri })
|
this.$emit('increment-hotp', { nextHotpCounter: otp.counter, nextUri: otp.uri })
|
||||||
|
Loading…
x
Reference in New Issue
Block a user