/** * @Route("/login", name="user_login", methods={"POST"}) */ public function login() { return $this->render('security/login.html.twig'); }
{% extends 'base.html.twig' %}
{% block title %}Connexion{% endblock %}
{% block body %} <h1>Connexion</h1>
<div class="container"> <form action="{{ path('user_login') }}" method="post"> <div class="form-group"> <input placeholder="Adresse email ..." required name="_username" type="text" class="form-control"> </div>
<div class="form-group"> <input placeholder="Mot de passe ..." required name="_password" type="password" class="form-control"> </div>
<button type="submit" class="btn btn-primary">Connexion</button></form>
<a href="{{ path('user_registration') }}">Inscription</a> </div>
{% endblock %}
security:
encoders: App\Entity\User: algorithm: bcrypt
providers: in_memory: { memory: ~ } our_db_provider: entity: class: App\Entity\User property: email
firewalls: main: anonymous: true
provider: our_db_provider
form_login: login_path: user_login check_path: user_login
logout: path: user_logout target: facture_new dev: pattern: ^/(_(profiler|wdt)|css|images|js)/ security: false
# activate different ways to authenticate
# http_basic: true
# form_login: true
# Easy way to control access for large sections of your site # Note: Only the *first* access control that matches will be used access_control: - { path: ^/admin, roles: ROLE_ADMIN } - { path: ^/profile, roles: ROLE_USER }
--
Vous recevez ce message, car vous êtes abonné au groupe Google Groupes "Association Francophone des Utilisateurs de Symfony".
Pour vous désabonner de ce groupe et ne plus recevoir d'e-mails le concernant, envoyez un e-mail à l'adresse asso-afsy+...@googlegroups.com.
Pour obtenir davantage d'options, consultez la page https://groups.google.com/d/optout.
<?php
namespace App\Entity;
use Doctrine\Common\Collections\ArrayCollection;use Doctrine\Common\Collections\Collection;use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Validator\Constraints as Assert;use Symfony\Component\Security\Core\Encoder\UserPasswordEncoderInterface;use Symfony\Component\Security\Core\User\UserInterface;use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
/** * @ORM\Entity(repositoryClass="App\Repository\UserRepository") * @UniqueEntity( * fields={"email"}, * message= "L'email que vous avez indiqué est déjà utilisé" * ) */class User implements UserInterface{ /** * @ORM\Id() * @ORM\GeneratedValue() * @ORM\Column(type="integer") */ private $id;
/** * @ORM\Column(type="string", length=255) */ private $name;
/** * @ORM\Column(type="string", length=255) */ private $username;
/** * @ORM\Column(type="string", length=255) * @Assert\Length( * min="6", * max="12", * minMessage="Votre mot de passe doit faire minimum 6 caractères", * maxMessage="Votre mot de passe doit faire maximum 12 caractères" * ) * @Assert\EqualTo(propertyPath="confirm_password", message="Vous n'avez pas tapé le même mot de passe") */ private $password;
/** * @ORM\Column(type="string", length=255) * @Assert\EqualTo(propertyPath="password") */ public $confirm_password;
/** * @ORM\Column(type="string", length=255) * @Assert\Email() */ private $email;
/** * @ORM\OneToMany(targetEntity="App\Entity\Facture", mappedBy="user") */ private $factures;
public function __construct() { $this->factures = new ArrayCollection(); }
public function getId(): ?int { return $this->id; }
public function getName(): ?string { return $this->name; }
public function setName(string $name): self { $this->name = $name;
return $this; }
public function getUsername(): ?string { return $this->username; }
public function setUsername(string $username): self { $this->username = $username;
return $this; }
public function getPassword(): ?string { return $this->password; }
public function setPassword(string $password): self { $this->password = $password;
return $this; }
public function getConfirm_Password(): ?string { return $this->confirm_password; }
public function getEmail(): ?string { return $this->email; }
public function setEmail(string $email): self { $this->email = $email;
return $this; }
/** * @return Collection|Facture[] */ public function getFactures(): Collection { return $this->factures; }
public function addFacture(Facture $facture): self { if (!$this->factures->contains($facture)) { $this->factures[] = $facture; $facture->setUser($this); }
return $this; }
public function removeFacture(Facture $facture): self { if ($this->factures->contains($facture)) { $this->factures->removeElement($facture); // set the owning side to null (unless already changed) if ($facture->getUser() === $this) { $facture->setUser(null); } }
return $this; }
public function eraseCredentials() {
}
public function getSalt() {
}
public function getRoles(): ?array { return ['ROLE_USER']; } /* public function setRoles(array $roles): self { $this->roles = $roles;
return $this; } */}
--
Vous recevez ce message, car vous êtes abonné au groupe Google Groupes "Association Francophone des Utilisateurs de Symfony".
Pour vous désabonner de ce groupe et ne plus recevoir d'e-mails le concernant, envoyez un e-mail à l'adresse asso-afsy+...@googlegroups.com.
Cette discussion peut être lue sur le Web à l'adresse https://groups.google.com/d/msgid/asso-afsy/27070099-529e-4c32-87f5-b72e9da2175a%40googlegroups.com.