forked from projects/fipamo
34 lines
690 B
PHP
34 lines
690 B
PHP
|
<?php
|
||
|
|
||
|
namespace App\Services;
|
||
|
|
||
|
use function _\find;
|
||
|
|
||
|
class AuthService
|
||
|
{
|
||
|
protected $config;
|
||
|
|
||
|
public function __construct(SettingsService $config)
|
||
|
{
|
||
|
$this->config = $config;
|
||
|
}
|
||
|
|
||
|
public function check($handle, $pass)
|
||
|
{
|
||
|
$folks = $this->config->getFolks();
|
||
|
$found = find($folks, ['handle' => $handle]);
|
||
|
if ($found) {
|
||
|
if (password_verify($pass, $found['password'])) {
|
||
|
return "WELCOME";
|
||
|
//DO SESSION STUFF
|
||
|
} else {
|
||
|
return "NOPE";
|
||
|
//RETURN ERROR
|
||
|
}
|
||
|
} else {
|
||
|
return "WHO ARE YOU?";
|
||
|
//RETURN ERROR
|
||
|
}
|
||
|
}
|
||
|
}
|