- Fixed a bug where given entity would failed it's loading with an error

This commit is contained in:
Dave M. 2023-12-12 18:57:03 -05:00
parent 70daae93f5
commit 0657622eab
2 changed files with 8 additions and 3 deletions

View File

@ -27,9 +27,14 @@ class Authenticate {
public function rememberMe() : ? UserInterface
{
$logUser = function(? int $id) {
try {
if ($id === null || null === ($user = $this->user::repository()->loadFromPk($id))) {
throw new \InvalidArgumentException(sprintf("User having id '%s' was not found.", $id));
}
}
catch(\Exception $ex) {
return null;
}
$this->user->fromArray($user);

View File

@ -21,7 +21,7 @@ class PostRequestAuthenticationMiddleware implements MiddlewareInterface
protected \Closure $loginFailedResponse,
PostRequestAuthentication $authenticator = null,
) {
$this->authenticator = $authenticator ?: new PostRequestAuthentication(new Authenticate());
$this->authenticator = $authenticator ?: new PostRequestAuthentication(new Authenticate($entity));
}
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface