forked from projects/fipamo
ro
a748b2c098
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
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
|
|
}
|
|
}
|
|
}
|