mirror of
https://github.com/openvk/chandler.git
synced 2024-11-15 11:39:09 +03:00
Add Authenticator::verifyCredentials to verify credentials without logging in
This commit is contained in:
parent
4adcf433c5
commit
55515de8b6
1 changed files with 9 additions and 1 deletions
|
@ -86,7 +86,7 @@ class Authenticator
|
||||||
$this->session->set("tok", $this->makeToken($user, CONNECTING_IP, $_SERVER["HTTP_USER_AGENT"]));
|
$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);
|
$user = $this->db->table("ChandlerUsers")->get($id);
|
||||||
if(!$user)
|
if(!$user)
|
||||||
|
@ -94,6 +94,14 @@ class Authenticator
|
||||||
else if(!$this->verifyHash($password, $user->passwordHash))
|
else if(!$this->verifyHash($password, $user->passwordHash))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
function login(string $id, string $password): bool
|
||||||
|
{
|
||||||
|
if(!$this->verifyCredentials($id, $password))
|
||||||
|
return false;
|
||||||
|
|
||||||
$this->authenticate($id);
|
$this->authenticate($id);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue