diff --git a/src/Database/Field/TLastLogin.php b/src/Database/Field/TLastLogin.php index ff2b64b..59f87de 100644 --- a/src/Database/Field/TLastLogin.php +++ b/src/Database/Field/TLastLogin.php @@ -15,9 +15,9 @@ public function getLastLogin(): ?\DateTime return $this->lastLogin; } - public function setLastLogin(): self + public function setLastLogin(?\DateTime $lastLogin): self { - $this->lastLogin = new \DateTime(); + $this->lastLogin = $lastLogin; return $this; } } \ No newline at end of file diff --git a/src/Database/Interface/IAuthenticable.php b/src/Database/Interface/IAuthenticable.php index 024eb9b..77245a8 100644 --- a/src/Database/Interface/IAuthenticable.php +++ b/src/Database/Interface/IAuthenticable.php @@ -23,7 +23,7 @@ public function getRoles(): Collection; /** @return Collection */ public function getResources(): Collection; - public function setLastLogin(): IAuthenticable; + public function setLastLogin(?\DateTime $lastLogin): IAuthenticable; public function setPassword(string $password): IAuthenticable; } \ No newline at end of file diff --git a/src/Http/Request/Auth/EmailAuthRequest.php b/src/Http/Request/Auth/EmailAuthRequest.php index 445ef42..557210c 100644 --- a/src/Http/Request/Auth/EmailAuthRequest.php +++ b/src/Http/Request/Auth/EmailAuthRequest.php @@ -71,7 +71,7 @@ public function process(array $data): Response $token->setExpiration($expiration); $token->setToken($jwt); - $user->setLastLogin(); + $user->setLastLogin(new \DateTime()); $this->em->flush($token); $this->em->flush($user);