Skip to content

Commit a5c0cff

Browse files
chore: Add PR's requested changes
1 parent 4624ff5 commit a5c0cff

2 files changed

Lines changed: 2 additions & 12 deletions

File tree

app/Repositories/DoctrineUserTrustedDeviceRepository.php

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -24,22 +24,14 @@ protected function getBaseEntity()
2424
return UserTrustedDevice::class;
2525
}
2626

27-
private function buildActiveExpiryExpr(): \Doctrine\Common\Collections\Expr\CompositeExpression
28-
{
29-
$now = new \DateTime('now', new \DateTimeZone('UTC'));
30-
return Criteria::expr()->orX(
31-
Criteria::expr()->gt('expires_at', $now),
32-
Criteria::expr()->isNull('expires_at')
33-
);
34-
}
35-
3627
public function getActiveByUserAndIdentifier(User $user, string $deviceIdentifier): ?UserTrustedDevice
3728
{
29+
$now = new \DateTime('now', new \DateTimeZone('UTC'));
3830
$criteria = Criteria::create()
3931
->where(Criteria::expr()->eq('user', $user))
4032
->andWhere(Criteria::expr()->eq('device_identifier', $deviceIdentifier))
4133
->andWhere(Criteria::expr()->eq('is_revoked', false))
42-
->andWhere($this->buildActiveExpiryExpr())
34+
->andWhere(Criteria::expr()->gt('expires_at', $now))
4335
->setMaxResults(1);
4436

4537
$result = $this->matching($criteria)->first();

app/libs/Auth/Models/TwoFactorAuditLog.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,4 @@ public function getMetadata(): ?array { return $this->metadata; }
8888
public function setMetadata(?array $value): void { $this->metadata = $value; }
8989

9090
public function getCreatedAt(): \DateTime { return $this->created_at; }
91-
92-
public function __get($name) { return $this->{$name}; }
9391
}

0 commit comments

Comments
 (0)