mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-06-21 01:25:55 +02:00
Added the database fields required by the new webauthn bundle versions
This commit is contained in:
parent
f4a67c0224
commit
91b7f2752f
2 changed files with 84 additions and 2 deletions
|
@ -50,6 +50,9 @@ class WebauthnKey extends BasePublicKeyCredentialSource implements TimeStampable
|
|||
#[ORM\ManyToOne(targetEntity: User::class, inversedBy: 'webauthn_keys')]
|
||||
protected ?User $user = null;
|
||||
|
||||
#[ORM\Column(type: Types::DATETIME_IMMUTABLE, nullable: true)]
|
||||
protected ?\DateTimeInterface $last_time_used = null;
|
||||
|
||||
//Fix compatibility with webauthn-library >= 4.8 which would fail with an "failed to access uvInitialized before initialization" error otherwise
|
||||
//TODO: Make these fields persistent, so that users can view these status infos in the UI
|
||||
public ?bool $uvInitialized = null;
|
||||
|
@ -83,9 +86,23 @@ class WebauthnKey extends BasePublicKeyCredentialSource implements TimeStampable
|
|||
return $this->id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve the last time when the key was used.
|
||||
* @return \DateTimeInterface|null
|
||||
*/
|
||||
public function getLastTimeUsed(): ?\DateTimeInterface
|
||||
{
|
||||
return $this->last_time_used;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Update the last time when the key was used.
|
||||
* @return void
|
||||
*/
|
||||
public function updateLastTimeUsed(): void
|
||||
{
|
||||
$this->last_time_used = new \DateTimeImmutable('now');
|
||||
}
|
||||
|
||||
public static function fromRegistration(BasePublicKeyCredentialSource $registration): self
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue