- Some minor fixes to match the EntityTrait relation loading
This commit is contained in:
parent
d7010b6c3b
commit
9508fb79f9
|
@ -68,7 +68,7 @@ class Authenticate {
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$this->user = $repository->loadOne();
|
$this->user = $repository->loadOne() ?: $repository->instanciateEntity();
|
||||||
}
|
}
|
||||||
catch(Exception\EmptyDatasetException $e) {
|
catch(Exception\EmptyDatasetException $e) {
|
||||||
call_user_func_array($this->authenticationEvent, [ false, 'userNotFound', $this->user ]);
|
call_user_func_array($this->authenticationEvent, [ false, 'userNotFound', $this->user ]);
|
||||||
|
@ -76,7 +76,7 @@ class Authenticate {
|
||||||
return $repository->instanciateEntity();
|
return $repository->instanciateEntity();
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( $this->user && $this->user->verifyPassword($password) ) {
|
if ( $this->user->isLoaded() && $this->user->verifyPassword($password) ) {
|
||||||
$this->user->logged = true;
|
$this->user->logged = true;
|
||||||
|
|
||||||
if ( $this->session ) {
|
if ( $this->session ) {
|
||||||
|
@ -90,9 +90,8 @@ class Authenticate {
|
||||||
call_user_func_array($this->authenticationEvent, [ true, 'success', $this->user ]);
|
call_user_func_array($this->authenticationEvent, [ true, 'success', $this->user ]);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$this->user = $repository->instanciateEntityCollection();
|
|
||||||
$this->user->logged = false;
|
$this->user->logged = false;
|
||||||
|
|
||||||
call_user_func_array($this->authenticationEvent, [ false, 'invalidPassword', $this->user ]);
|
call_user_func_array($this->authenticationEvent, [ false, 'invalidPassword', $this->user ]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue