- Fixed deleted users which tries to login/refresh - triggers a logout().
- Password is now optional, allowing easier hi-jacking of the login process, like through an OAuth or LDAP.
This commit is contained in:
parent
c38f47d9a7
commit
55a7af6ac9
|
@ -37,6 +37,8 @@ class Authenticate {
|
|||
{
|
||||
$logUser = function(int $id) use ($repository) {
|
||||
if ( null === ( $user = $repository->loadFromPk($id) ) ) {
|
||||
$this->logout();
|
||||
|
||||
throw new \Exception("User not found.");
|
||||
}
|
||||
|
||||
|
@ -61,7 +63,7 @@ class Authenticate {
|
|||
$this->session->destroy();
|
||||
}
|
||||
|
||||
public function authenticate(\Ulmus\Repository $repository, array $userLogin, string $password) : User
|
||||
public function authenticate(\Ulmus\Repository $repository, array $userLogin, ? string $password) : User
|
||||
{
|
||||
foreach($userLogin as $field => $value) {
|
||||
$repository->or($field, $value);
|
||||
|
@ -111,7 +113,7 @@ class Authenticate {
|
|||
$this->cookie->delete('user.id');
|
||||
}
|
||||
|
||||
$this->user->logged = false;
|
||||
$this->user && $this->user->logged = false;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue