authentification bootstrap

pull/12/head
Samuel 1 year ago committed by samuel
parent 2c784086ac
commit 102c7a21be

@ -68,4 +68,24 @@ class Color {
+ getValue(): int
}
class AuthController{
+ login (requete) : int
+ register (requete) : int
}
AuthController --> "- modelAuth" AuthModel
class AuthModel{
+ login (mail : string, password : string)
+ register (mail : string, password :string)
}
AuthModel --> "- gateway" AuthGateway
class AuthGateway{
+ insert(mail : string, password : string)
+ isAccountEqual(mail : string, password : string)
}
@enduml

@ -35,10 +35,13 @@ $router = new AltoRouter();
$router->setBasePath($basePath);
$sampleFormController = new SampleFormController(new FormResultGateway($con), $twig);
$authController = new \App\Controller\AuthController(new \App\Gateway\AuthGateway(), $twig);
$router->map("GET", "/", fn() => $sampleFormController->displayForm());
$router->map("POST", "/submit", fn() => $sampleFormController->submitForm($_POST));
$router->map("GET", "/twig", fn() => $sampleFormController->displayFormTwig());
$router->map("POST", "/submit-twig", fn() => $sampleFormController->submitFormTwig($_POST));
$router->map("GET", "/register", fn() => $authController->displayRegister());
$match = $router->match();

@ -1,8 +1,10 @@
-- drop tables here
DROP TABLE IF EXISTS FormEntries;
DROP TABLE IF EXISTS AccountUser;
CREATE TABLE FormEntries(name varchar, description varchar);
CREATE TABLE AccountUser(name varchar, profilPicture varchar, age int);

@ -2,16 +2,27 @@
namespace App\Controller;
use App\Gateway\AccountGateway;
use App\Gateway\AuthGateway;
use App\Model\AuthModel;
use Twig\Environment;
class AccountController
class AuthController
{
private AccountGateway $gateway;
private Environment $twing;
private AuthModel $model;
private Environment $twig;
public function display(){
require "src/Views/display_login.html.twig";
/**
* @param AuthModel $model
* @param Environment $twig
*/
public function __construct(AuthModel $model, Environment $twig)
{
$this->model = $model;
$this->twig = $twig;
}
public function displayRegister(){
echo $this->twig->render("display_register.html.twig",[]);
}

@ -2,7 +2,7 @@
namespace App\Gateway;
class AccountGateway
class AuthGateway
{
}

@ -2,7 +2,10 @@
namespace App\Model;
use App\Controller\AuthController;
class AuthModel
{
private AuthController $controller;
}

@ -2,7 +2,7 @@
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Log in</title>
<title>S'enregistrer</title>
</head>
<body>
@ -56,12 +56,11 @@
</style>
<div class="container">
<h2>S'enregistrer</h2>
<center><h2>S'enregistrer</h2></center>
<form action="/register" method="post">
<div class="form-group">
<label for="username">Nom d'utilisateur :</label>
<input type="text" id="username" name="username" required>
<label for= "password">Mot de passe :</label>
<input type="text" id="password" name="password" required>
<label for="confirmpassword">Confirmer le mot de passe :</label>

Loading…
Cancel
Save