MAPG-45 secure profile page

This commit is contained in:
Bence Pőcze 2020-06-14 21:04:20 +02:00
parent 6d431717f8
commit bd2b28ef17

View File

@ -1,12 +1,13 @@
<?php namespace MapGuesser\Controller; <?php namespace MapGuesser\Controller;
use MapGuesser\Database\Query\Modify; use MapGuesser\Database\Query\Modify;
use MapGuesser\Interfaces\Authorization\ISecured;
use MapGuesser\Interfaces\Request\IRequest; use MapGuesser\Interfaces\Request\IRequest;
use MapGuesser\Interfaces\Response\IContent; use MapGuesser\Interfaces\Response\IContent;
use MapGuesser\Response\HtmlContent; use MapGuesser\Response\HtmlContent;
use MapGuesser\Response\JsonContent; use MapGuesser\Response\JsonContent;
class UserController class UserController implements ISecured
{ {
private IRequest $request; private IRequest $request;
@ -15,6 +16,13 @@ class UserController
$this->request = $request; $this->request = $request;
} }
public function authorize(): bool
{
$user = $this->request->user();
return $user !== null;
}
public function getProfile(): IContent public function getProfile(): IContent
{ {
$user = $this->request->user(); $user = $this->request->user();