fipamo/app/Services/AuthService.php
ro a748b2c098
Added Auth and Settings service class
Plugged in a basic auth classs for verifying members and a setting class
to retrieve site settings and return necessary info.

Very bare bones to start just to get it working and prep for the
additional features
2024-03-01 13:34:36 -06:00

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
}
}
}