diff --git a/chandler/Security/Authenticator.php b/chandler/Security/Authenticator.php index e2f307b..f7ed2a7 100644 --- a/chandler/Security/Authenticator.php +++ b/chandler/Security/Authenticator.php @@ -86,7 +86,7 @@ class Authenticator $this->session->set("tok", $this->makeToken($user, CONNECTING_IP, $_SERVER["HTTP_USER_AGENT"])); } - function login(string $id, string $password): bool + function verifyCredentials(string $id, string $password): bool { $user = $this->db->table("ChandlerUsers")->get($id); if(!$user) @@ -94,6 +94,14 @@ class Authenticator else if(!$this->verifyHash($password, $user->passwordHash)) return false; + return true; + } + + function login(string $id, string $password): bool + { + if(!$this->verifyCredentials($id, $password)) + return false; + $this->authenticate($id); return true; }