Finalisation Connexion user - Ajout lien Reinit mot de passe - Ajout Profil user

This commit is contained in:
nox 2019-11-18 21:46:33 +01:00
parent 0e895c8ae1
commit 3e65bf1fcf
12 changed files with 115 additions and 25 deletions

View File

@ -23,6 +23,14 @@ img {
max-width: 100%;
height: auto;
}
#la_page {
text-align: center;
width: 1174px;
min-height: 901px;
height:auto;
margin-left: auto;
margin-right: auto;
}
#la_page a {
color: #5B5EA6;
@ -77,14 +85,6 @@ header.header img {
font-family: Bree serif, Arial;
font-size: 26px;
}
#la_page {
text-align: center;
width: 1174px;
min-height: 901px;
height:auto;
margin-left: auto;
margin-right: auto;
}
.article {
width:auto;
@ -99,6 +99,12 @@ header.header img {
.container {
font-family: Arial, sans-serif;
}
.profil_user {
height: 400px;
width: 900px;
background-color: lightgray;
text-align: center;
}
.records_content th, .records_content2 th {
background-color: lightgray;
color: rgba(0,0,0,0.85);
@ -108,7 +114,9 @@ header.header img {
margin: 5px auto;
text-align: center;
}
/******************************************************************/
/* signup.twig */
/******************************************************************/
#signupContain {
background-color: lightgray;
opacity: 0.9;
@ -128,7 +136,7 @@ header.header img {
display: inline-block;
}
#champsOgligatoire {
#champsObligatoires {
float: right;
font-size: 0.8em;
}
@ -137,6 +145,13 @@ header.header img {
display: block;
margin: auto;
}
/******************************************************************/
/* layout.twig */
/******************************************************************/
.mdp_oublie:hover {
background-color: deepskyblue;
}
/******************************************************************/
/* LOADING PUBKEY */

View File

@ -3,6 +3,7 @@ namespace App\Account;
use App\Account\Action\AccountAction;
use App\Account\Action\AccountEditAction;
use App\Account\Action\ProfilAction;
use App\Account\Action\SignupAction;
use Framework\Auth\LoggedInMiddleware;
use Framework\Module;
@ -23,5 +24,7 @@ class AccountModule extends Module
$router->post('/inscription', SignupAction::class);
$router->get('/mon-profil', [LoggedInMiddleware::class, AccountAction::class], 'account');
$router->post('/mon-profil', [LoggedInMiddleware::class, AccountEditAction::class]);
$router->get('/profil-utilisateur', ProfilAction::class, 'account.profil');
$router->post('/profil-utilisateur', ProfilAction::class);
}
}

View File

@ -0,0 +1,39 @@
<?php
namespace App\Account\Action;
use Framework\Auth;
use Framework\Renderer\RendererInterface;
use Psr\Http\Message\ServerRequestInterface;
class ProfilAction
{
/**
* @var RendererInterface
*/
private $renderer;
/**
* @var Auth
*/
private $auth;
public function __construct(
RendererInterface $renderer,
Auth $auth
) {
$this->renderer = $renderer;
$this->auth = $auth;
}
public function __invoke(ServerRequestInterface $request)
{
/* Transmission du nom de l'utilistateur connecté à la vue Twig */
session_start();
if (isset($_SESSION['user'])) {
$nom_user = $_SESSION['user'];
} else {
$nom_user = '';
}
return $this->renderer->render('@account/profil', compact('nom_user'));
}
}

View File

@ -0,0 +1,15 @@
{% extends 'layout.twig' %}
{% block body %}
<div class="profil_user" style="margin-top:5px;">
<h4>Profil utilisateur {{ nom_user }}</h4>
<div>
<h5>Biens achetés</h5>
</div>
<div>
<h5>Biens vendus</h5>
</div>
</div>
{% endblock %}

View File

@ -13,7 +13,7 @@
{{ field('email', user.email, "Email *", {type: 'email'}) }}
{{ field('password', null, "Mot de passe *", {type: 'password'}) }}
{{ field('password_confirm', null, "Confirmez le mot de passe *", {type: 'password'}) }}
<div id="champsOgligatoire">* Champs obligatoires</div>
<div id="champsObligatoires">* Champs obligatoires</div>
{{ field('created_at', date(), null, {type: 'hidden'}) }}
<button class="btn btn-primary" id="validSignup">S'inscrire</button>
</form>

View File

@ -39,7 +39,6 @@ class LoginAttemptAction
Router $router,
SessionInterface $session
) {
$this->renderer = $renderer;
$this->auth = $auth;
$this->router = $router;
@ -51,7 +50,8 @@ class LoginAttemptAction
$params = $request->getParsedBody();
$user = $this->auth->login($params['username'], $params['password']);
if ($user) {
$path = $this->session->get('auth.redirect') ?: $this->router->generateUri('gmarche.index');
$path = $this->session->get('auth.redirect');
$path = $this->session->get('auth.redirect') ?? $this->router->generateUri('gmarche.index');
$this->session->delete('auth.redirect');
return new RedirectResponse($path);
} else {

View File

@ -63,7 +63,7 @@ class PasswordForgetAction
$this->flashService->success('Un email vous a été envoyé');
return new RedirectResponse($request->getUri()->getPath());
} catch (NoRecordException $e) {
$errors = ['email' => 'Aucun utilisateur ne correspon à cet email'];
$errors = ['email' => 'Aucun utilisateur ne correspond à cet email'];
}
} else {
$errors = $validator->getErrors();

View File

@ -56,7 +56,7 @@ class PasswordResetAction
} else {
$params = $request->getParsedBody();
$validator = (new Validator($params))
->length('password', 4)
->length('password', 8)
->confirm('password');
if ($validator->isValid()) {
$this->userTable->updatePassword($user->getId(), $params['password']);

View File

@ -1,5 +1,10 @@
<p>
Vous avez demandé la réinitialisation de votre de mot de passe.
Site Ğ1-Marché
</p>
<p>
Vous avez demandé la réinitialisation de votre mot de passe.
<br />
Veuillez pour se faire, cliquer sur le lien ci-dessous :
</p>
<p>
<a href="{{ domain }}{{ path('auth.reset', {id: id, token: token}) }}">{{ domain }}{{ path('auth.reset', {id: id, token: token}) }}</a>

View File

@ -1,3 +1,7 @@
Vous avez demandé la réinitialisation de votre de mot de passe.
Site Ğ1-Marché
Vous avez demandé la réinitialisation de votre mot de passe.
Veuillez pour se faire, cliquer sur le lien ci-dessous :
{{ domain }}{{ path('auth.reset', {id: id, token: token}) }}

View File

@ -3,7 +3,7 @@
{% block body %}
<div class="container" style="color:floralwhite;background-color: #333333;padding: 1rem;">
{% if flash('error') %}
<div class="alert alert-danger">
{{ flash('error') }}
@ -14,7 +14,7 @@
{{ csrf_input() }}
{{ field('password', null, 'Mot de passe', {type: 'password'}) }}
{{ field('password_confirm', null, 'Confirmer le mot de passe', {type: 'password'}) }}
<button class="btn btn-primary">Réinitialiser mon mot de passe</button>
<button class="btn btn-primary">Enregistrer mon nouveau mot de passe</button>
</form>
</div>
{% endblock %}

View File

@ -47,21 +47,24 @@
</li>
</ul>
<div class="navbar-nav">
<div class="navbar-text" style="color:lightgray;margin-right:15px; margin-top:-3px;">
<div class="navbar-text" style="color:lightgray;margin-right:15px; margin-top:3px;">
{{ "now"|date('d/m/y') }}
</div>
<!--{pourcent if current_user() pourcent}-->
{% if nom_user != '' %}
<div class="navbar-text" id="user"><span><img src="\avatar_user.png" width="22" height="22" /></span>
<span id="nom_connecte">{{ nom_user }}</span>
</div>
<!-- <button style="background-color: transparent;padding:0;border:0;" -->
<form method="post" style="margin-top:5px;" action="{{ path('account.profil') }}">
<span><img src="\avatar_user.png" width="22" height="22" /></span>
<!--<span id="nom_connecte"> nom_user </span>-->
<button style="color:white;font-size: 14px;" class="btn-primary">{{ nom_user }}</button>
</form>
<form method="post" action="{{ path('auth.logout') }}">
<!-- csrf_input() }}-->
<button class="btn btn-danger" style="margin-left: 7px; font-size:14px;">Se déconnecter</button>
</form>
{% else %}
<div class="nav-item" id="bouton-connexion">
<button style="color:white; font-size: 14px;" class="btn btn-primary" data-toggle="modal" data-target="#connexion_modal">Se connecter
<button style="color:white; font-size: 14px;" class="btn btn-primary" data-toggle="modal" data-target="#connexion_modal">Se connecter</button>
</div>
<div id="nom_connecte" style="display:none;margin-left:10px;margin-top:6px;margin-right:8px;">
</div>
@ -86,6 +89,7 @@
</div>
{% block body %}{% endblock %}
<div class="modal fade" id="connexion_modal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
<div class="modal-dialog" role="document" style="color: black;">
<div class="modal-content" style="text-align: left;">
@ -103,6 +107,11 @@
<input type="password" id="mdp" class="form-control"/>
</div>
</div>
<div class="modal-body">
<button class="mdp_oublie" type="button" class="btn-default">
<a style="color:gray;" href="{{ path('auth.password') }}">Mot de passe oublié ?</a>
</button>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Annuler</button>
<button type="button" class="btn btn-primary"