Skip to content

Commit

Permalink
Improved IAuthenticable interface
Browse files Browse the repository at this point in the history
  • Loading branch information
jzaplet committed Mar 30, 2024
1 parent 627d426 commit a6cda29
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/Database/Field/TLastLogin.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
2 changes: 1 addition & 1 deletion src/Database/Interface/IAuthenticable.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public function getRoles(): Collection;
/** @return Collection<int, Resource> */
public function getResources(): Collection;

public function setLastLogin(): IAuthenticable;
public function setLastLogin(?\DateTime $lastLogin): IAuthenticable;

public function setPassword(string $password): IAuthenticable;
}
2 changes: 1 addition & 1 deletion src/Http/Request/Auth/EmailAuthRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit a6cda29

Please sign in to comment.