1
0
mirror of https://koodu.h-i.works/projects/thebadspace synced 2025-06-25 16:04:37 -05:00

Auth Framework, Part 2

Auth class is back up and running to handle user authorizaion
as well as session managment.
Implemented basic usage on admin index class just for an example.

Added a couple of new template files and css to start defining the
overall style of pages and UI.
This commit is contained in:
Ro
2022-12-13 14:46:45 -08:00
parent 54b5227a0d
commit e424df18aa
10 changed files with 159 additions and 36 deletions

View File

@ -6,7 +6,7 @@ namespace App\Service;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Component\HttpFoundation\RequestStack;
use App\Entity\Members;
use App\Entity\Member;
use ReallySimpleJWT\Token;
class Auth
@ -23,12 +23,12 @@ class Auth
$this->secret = '!$ec7eT$l0w*';
}
public function authCheck($email, $password)
public function authCheck($handle, $password)
{
$response = [];
$member = new Members();
$members = $this->entityManager->getRepository(Members::class);
$member = $members->findOneBy(["email" => $email]);
$member = new Member();
$members = $this->entityManager->getRepository(Member::class);
$member = $members->findOneBy(["handle" => $handle]);
if (!$member) {
$response = ["status" => false, "message" => "Member Not Found"];
} else {
@ -40,10 +40,10 @@ class Auth
$secret = $this->secret;
$expiration = time() + 3600;
$token = Token::create(
$member->getMemberId(),
$member->getId(),
$secret,
$expiration,
"nile_admin"
"bad_space_admin"
);
$this->session->set("token", $token);