before recipes:update
This commit is contained in:
.eslintrccomposer.jsoncomposer.lockpackage.jsonrector.php
assets
images
js
App.vue
components
AppLink.vueHandleLogout.vueLoginForm.vueNotFound.vueTheFooter.vueTheNavbar.vueTheSidebar.vuefooter.vuelogin.vuenot-found.vue
index.jspages
projects
quotes
sidebar.vuetabs
users
router
styles
src
Controller
Entity
Repository
Security
templates
webpack.config.jsyarn.lock@ -46,7 +46,7 @@ class SecurityController extends AbstractController
|
||||
* @return mixed
|
||||
*/
|
||||
#[Route(path: '/logout', name: 'app_logout')]
|
||||
public function logout(): mixed
|
||||
public function logout(): never
|
||||
{
|
||||
throw new Exception(message: 'Logout should never be reached.');
|
||||
}
|
||||
|
@ -16,10 +16,8 @@ use Symfony\Component\Security\Core\Exception\UserNotFoundException;
|
||||
class UserController extends AbstractController
|
||||
{
|
||||
/**
|
||||
* @param \App\Repository\UserRepository $userRepository
|
||||
* @param string $userName
|
||||
*
|
||||
* @return \Symfony\Component\HttpFoundation\Response
|
||||
*/
|
||||
#[Route(path: '/profile/edit/{username}', name: 'app_profile_edit')]
|
||||
public function editProfile(UserRepository $userRepository, string $username = ''): Response
|
||||
@ -48,12 +46,6 @@ class UserController extends AbstractController
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \App\Repository\UserRepository $userRepository
|
||||
* @param string $username
|
||||
*
|
||||
* @return \Symfony\Component\HttpFoundation\Response
|
||||
*/
|
||||
#[Route(path: '/profile/{username}', name: 'app_profile')]
|
||||
public function showProfile(UserRepository $userRepository, string $username = ''): Response
|
||||
{
|
||||
@ -71,11 +63,6 @@ class UserController extends AbstractController
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \App\Repository\UserRepository $userRepository
|
||||
*
|
||||
* @return \Symfony\Component\HttpFoundation\Response
|
||||
*/
|
||||
#[Route(path: '/list_users/', name: 'app_list_user')]
|
||||
public function listUsers(UserRepository $userRepository): Response
|
||||
{
|
||||
|
@ -10,27 +10,27 @@ use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
#[ORM\Entity(repositoryClass: ProjectsRepository::class)]
|
||||
#[ApiResource]
|
||||
class Projects
|
||||
class Projects implements \Stringable
|
||||
{
|
||||
#[ORM\Id]
|
||||
#[ORM\GeneratedValue]
|
||||
#[ORM\Column(type: 'integer')]
|
||||
private ?int $id;
|
||||
private ?int $id = null;
|
||||
|
||||
#[ORM\Column(type: 'string', length: 255)]
|
||||
private ?string $name;
|
||||
private ?string $name = null;
|
||||
|
||||
#[ORM\Column(type: 'string', length: 255)]
|
||||
private ?string $description;
|
||||
private ?string $description = null;
|
||||
|
||||
#[ORM\Column(type: 'string', length: 255)]
|
||||
private ?string $url;
|
||||
private ?string $url = null;
|
||||
|
||||
#[ORM\Column(type: 'datetime_immutable')]
|
||||
private ?\DateTimeImmutable $createdAt;
|
||||
private ?\DateTimeImmutable $createdAt = null;
|
||||
|
||||
#[ORM\Column(type: 'string', length: 255, nullable: true)]
|
||||
private ?string $teaserImage;
|
||||
private ?string $teaserImage = null;
|
||||
|
||||
#[ORM\ManyToMany(targetEntity: User::class, inversedBy: 'projects')]
|
||||
private $developer;
|
||||
@ -43,9 +43,9 @@ class Projects
|
||||
/**
|
||||
* @return string|null
|
||||
*/
|
||||
public function __toString()
|
||||
public function __toString(): string
|
||||
{
|
||||
return $this->name;
|
||||
return (string) $this->name;
|
||||
}
|
||||
|
||||
public function getId(): ?int
|
||||
|
@ -15,16 +15,17 @@ use Symfony\Component\Security\Core\User\UserInterface;
|
||||
|
||||
/**
|
||||
* => ["security" => "is_granted('ROLE_ADMIN') or object.owner == user"]
|
||||
attributes : ['security' => 'is_granted("ROLE_USER")']
|
||||
|
||||
*/
|
||||
#[ORM\Entity(repositoryClass: UserRepository::class), ORM\HasLifecycleCallbacks]
|
||||
#[ApiResource(
|
||||
collectionOperations: ['get', 'post'],
|
||||
itemOperations : ['get'],
|
||||
attributes : ['security' => 'is_granted("ROLE_USER")']
|
||||
)]
|
||||
#[ApiFilter(filterClass: SearchFilter::class, properties: ['username' => 'exact'])]
|
||||
|
||||
class User implements UserInterface, PasswordAuthenticatedUserInterface
|
||||
class User implements UserInterface, PasswordAuthenticatedUserInterface, \Stringable
|
||||
{
|
||||
#[ORM\Id]
|
||||
#[ORM\GeneratedValue]
|
||||
@ -55,7 +56,7 @@ class User implements UserInterface, PasswordAuthenticatedUserInterface
|
||||
private $projects;
|
||||
|
||||
#[ORM\Column(type: 'string', length: 255, nullable: true)]
|
||||
private $avatar;
|
||||
private string $avatar;
|
||||
|
||||
#[ORM\OneToMany(mappedBy: 'owner', targetEntity: Pages::class)]
|
||||
private $pages;
|
||||
@ -75,7 +76,7 @@ class User implements UserInterface, PasswordAuthenticatedUserInterface
|
||||
/**
|
||||
* @return string|null
|
||||
*/
|
||||
public function __toString()
|
||||
public function __toString(): string
|
||||
{
|
||||
return $this->username;
|
||||
}
|
||||
@ -244,9 +245,9 @@ class User implements UserInterface, PasswordAuthenticatedUserInterface
|
||||
|
||||
public function addPage(Pages $page): self
|
||||
{
|
||||
if (!$this->pages->contains($page)) {
|
||||
if (!$this->pages->contains(element: $page)) {
|
||||
$this->pages[] = $page;
|
||||
$page->setOwner($this);
|
||||
$page->setOwner(owner: $this);
|
||||
}
|
||||
|
||||
return $this;
|
||||
@ -254,10 +255,10 @@ class User implements UserInterface, PasswordAuthenticatedUserInterface
|
||||
|
||||
public function removePage(Pages $page): self
|
||||
{
|
||||
if ($this->pages->removeElement($page)) {
|
||||
if ($this->pages->removeElement(element: $page)) {
|
||||
// set the owning side to null (unless already changed)
|
||||
if ($page->getOwner() === $this) {
|
||||
$page->setOwner(null);
|
||||
$page->setOwner(owner: null);
|
||||
}
|
||||
}
|
||||
|
||||
@ -287,8 +288,11 @@ class User implements UserInterface, PasswordAuthenticatedUserInterface
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getAvatarUri()
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getAvatarUri()
|
||||
{
|
||||
return 'avatar';
|
||||
}
|
||||
|
@ -46,7 +46,7 @@ class QuotesRepository extends ServiceEntityRepository
|
||||
->select('MIN(q.id)', 'MAX(q.id)')
|
||||
->getQuery()
|
||||
->getOneOrNullResult();
|
||||
$randomPossibleId = rand(min: $idLimits[1], max: $idLimits[2]);
|
||||
$randomPossibleId = random_int(min: $idLimits[1], max: $idLimits[2]);
|
||||
|
||||
return $this->createQueryBuilder(alias: 'q')
|
||||
->where(predicates: 'q.id >= :random_id')
|
||||
|
@ -45,7 +45,7 @@ class UserRepository extends ServiceEntityRepository implements PasswordUpgrader
|
||||
public function upgradePassword(PasswordAuthenticatedUserInterface $user, string $newHashedPassword): void
|
||||
{
|
||||
if (!$user instanceof User) {
|
||||
throw new UnsupportedUserException(message: sprintf('Instances of "%s" are not supported.', get_class(object: $user)));
|
||||
throw new UnsupportedUserException(message: sprintf('Instances of "%s" are not supported.', $user::class));
|
||||
}
|
||||
|
||||
$user->setPassword(password: $newHashedPassword);
|
||||
|
@ -26,15 +26,9 @@ class LoginFormAuthenticator extends AbstractLoginFormAuthenticator
|
||||
{
|
||||
use TargetPathTrait;
|
||||
|
||||
private UserRepository $userRepository;
|
||||
|
||||
private RouterInterface $router;
|
||||
|
||||
public function __construct(UserRepository $userRepository, RouterInterface $router)
|
||||
{
|
||||
$this->userRepository = $userRepository;
|
||||
$this->router = $router;
|
||||
}
|
||||
public function __construct(private readonly UserRepository $userRepository, private readonly RouterInterface $router)
|
||||
{
|
||||
}
|
||||
|
||||
public function authenticate(Request $request): Passport
|
||||
{
|
||||
@ -61,9 +55,7 @@ class LoginFormAuthenticator extends AbstractLoginFormAuthenticator
|
||||
}),
|
||||
|
||||
// remove me later for PasswordCredentials()
|
||||
credentials: new CustomCredentials(customCredentialsChecker: function ($credentials, User $user) {
|
||||
return $credentials === 'test';
|
||||
}, credentials : $password),
|
||||
credentials: new CustomCredentials(customCredentialsChecker: fn($credentials, User $user) => $credentials === 'test', credentials : $password),
|
||||
|
||||
// new PasswordCredentials($password),
|
||||
badges: [
|
||||
|
Reference in New Issue
Block a user