allow users to recover password

This commit is contained in:
2018-08-17 13:32:08 +02:00
parent 5b1ba71a8a
commit 1fd6a4ed2c
22 changed files with 896 additions and 11 deletions

View File

@@ -21,6 +21,14 @@ chill_main_exports:
chill_postal_code:
resource: "@ChillMainBundle/Resources/config/routing/postal-code.yml"
prefix: "{_locale}/postal-code"
chill_password:
resource: "@ChillMainBundle/Resources/config/routing/password.yml"
prefix: "{_locale}/password"
chill_password_recover:
resource: "@ChillMainBundle/Resources/config/routing/password_recover.yml"
prefix: "public/{_locale}/password"
root:
path: /
@@ -78,7 +86,3 @@ login_check:
logout:
path: /logout
change_my_password:
path: /{_locale}/password/edit
defaults: { _controller: ChillMainBundle:Password:userPassword }

View File

@@ -0,0 +1,4 @@
change_my_password:
path: /edit
defaults: { _controller: ChillMainBundle:Password:userPassword }

View File

@@ -0,0 +1,15 @@
password_recover:
path: /recover
defaults: { _controller: ChillMainBundle:Password:recover }
password_request_recover:
path: /request-recover
defaults: { _controller: ChillMainBundle:Password:requestRecover }
password_request_recover_confirm:
path: /request-confirm
defaults: { _controller: ChillMainBundle:Password:requestRecoverConfirm }
password_request_recover_changed:
path: /request-changed
defaults: { _controller: ChillMainBundle:Password:changeConfirmed }

View File

@@ -0,0 +1,10 @@
services:
Chill\MainBundle\Notification\Mailer:
arguments:
- "@logger"
- "@twig"
- "@mailer"
- "@swiftmailer.transport"
- "@router"
- "@translator"
- "%chill_main.notifications%"

View File

@@ -20,4 +20,15 @@ services:
$authorizationHelper: '@Chill\MainBundle\Security\Authorization\AuthorizationHelper'
tags:
- { name: security.voter }
Chill\MainBundle\Security\PasswordRecover\TokenManager:
arguments:
$secret: 'secret'
$logger: '@Psr\Log\LoggerInterface'
Chill\MainBundle\Security\PasswordRecover\RecoverPasswordHelper:
arguments:
$tokenManager: '@Chill\MainBundle\Security\PasswordRecover\TokenManager'
$urlGenerator: '@Symfony\Component\Routing\Generator\UrlGeneratorInterface'
$mailer: '@Chill\MainBundle\Notification\Mailer'

View File

@@ -43,7 +43,7 @@ label {
padding-right: 5px;
}
input {
color: 'black';
}
form {
@@ -61,3 +61,12 @@ button {
font-weight: 300;
}
p.forgot-password-link {
text-align: center;
a {
font-weight: 300;
color: #fff;
text-decoration: none;
}
}

View File

@@ -189,6 +189,22 @@ Choose the format: Choisir le format
'select2.error_loading': Erreur de chargement des résultats
'select2.searching': Recherche en cours...
# page changement mot de passe
# change password
Change my password: Modification du mot de passe
Your actual password: Mot de passe actuel
Your actual password: Mot de passe actuel
# recover password
Forgot your password ?: Mot de passe oublié ?
Recover password: Remplacement du mot de passe
Username or email: Nom d'utilisateur ou email
Request recover: Demande de remplacement
Check your email: Vérifiez votre courriel
An email has been sent to your address. Click on the link inside this email to confirm that you are the owner of this account.: Un courriel a été envoyé à votre adresse. Cliquez sur le lien de cet email pour confirmer que vous êtes bien le propriétaire de ce compte.
You requested to recover your password: Vous avez demandé à renouveler votre mot de passe.
Click on the link below to recover your password: Cliquez sur le lien ci-dessous pour re-générer votre mot de passe
Regards,: Cordialement,
Your administrator: Votre administrateur
Recover your password: Regénération du mot de passe
New password set: Le nouveau mot de passe est enregistré
Your password has been set.: Votre mot de passe a été changé.
Log in with your new password: Connectez-vous avec votre nouveau mot de passe

View File

@@ -4,6 +4,7 @@ The role "%role%" require to be associated with a scope.: Le rôle "%role%" doit
The role "%role%" should not be associated with a scope.: Le rôle "%role%" ne doit pas être associé à un cercle.
"The password must contains one letter, one capitalized letter, one number and one special character as *[@#$%!,;:+\"'-/{}~=µ()£]). Other characters are allowed.": "Le mot de passe doit contenir une majuscule, une minuscule, et au moins un caractère spécial parmi *[@#$%!,;:+\"'-/{}~=µ()£]). Les autres caractères sont autorisés."
The password fields must match: Les mots de passe doivent correspondre
The password must be greater than {{ limit }} characters: "[1,Inf] Le mot de passe doit contenir au moins {{ limit }} caractères"
A permission is already present for the same role and scope: Une permission est déjà présente pour le même rôle et cercle.

View File

@@ -42,9 +42,11 @@
<input type="password" name="_password" />
<input type="hidden" name="_csrf_token" value="{{ csrf_token('authenticate') }}" />
<br/>
<button type="submit" name="login">{{ 'Login'|trans }}</button>
<button type="submit" name="login">{{ 'Login'|trans }}</button>
</form>
<p class="forgot-password-link"><a href="{{ path('password_request_recover') }}">{{ 'Forgot your password ?'|trans }}</a></p>
</div>
</body>
</html>

View File

@@ -0,0 +1,10 @@
{{ user.username }},
{{ 'You requested to recover your password'|trans }}
{{ 'Click on the link below to recover your password'|trans }} :
{{ url|raw }}
{{ 'Regards,'|trans }}
{{ 'Your administrator'|trans }}

View File

@@ -0,0 +1,49 @@
{#
* Copyright (C) 2014-2015, Champs Libres Cooperative SCRLFS,
<info@champs-libres.coop> / <http://www.champs-libres.coop>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
#}
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>
{{ 'Login to %installation_name%' | trans({ '%installation_name%' : installation.name } ) }}
</title>
<link rel="shortcut icon" href="{{ asset('build/images/favicon.ico') }}" type="image/x-icon">
<link rel="stylesheet" href="{{ asset('build/chill.css') }}"/>
</head>
<body>
<header class="navigation container">
<div class="grid-4 hide-tablet hide-mobile parent">
<div class="grid-10 push-2 grid-tablet-12 grid-mobile-12 push-tablet-0 grid-mobile-0 logo-container">
<a href="{{ path('chill_main_homepage') }}">
<img class="logo" src="{{ asset('build/images/logo-chill-sans-slogan_white.png') }}">
</a>
</div>
</div>
</header>
<div id="content">
{% block content %}{% endblock %}
</div>
</body>
</html>

View File

@@ -0,0 +1,14 @@
{% extends "@ChillMain/Password/recover_layout.html.twig" %}
{% block title %}{{ "New password set"|trans }}{% endblock %}
{% block content %}
<div class="grid-10 grid-mobile-10 grid-tablet-10 centered">
<h1>{{ "New password set"|trans }}</h1>
<p>{{ "Your password has been set."|trans }} <a href="{{ path('login') }}">{{ "Log in with your new password"|trans }}</a></p>
</div>
{% endblock %}

View File

@@ -0,0 +1,25 @@
{% extends "@ChillMain/Password/recover_layout.html.twig" %}
{% set title = app.request.get('title', "Recover your password"|trans) %}
{% block title %}{{ title }}{% endblock %}
{% block content %}
<div class="grid-10 grid-mobile-10 grid-tablet-10 centered">
<h1>{{ title }}</h1>
{{ form_start(form) }}
{{ form_row(form.new_password) }}
<ul class="record_actions">
<li>
{{ form_widget(form.submit, { 'attr': { 'class': 'sc-button orange' } } ) }}
</li>
</ul>
{{ form_end(form) }}
</div>
{% endblock %}

View File

@@ -0,0 +1,43 @@
{#
* Copyright (C) 2014-2015, Champs Libres Cooperative SCRLFS,
<info@champs-libres.coop> / <http://www.champs-libres.coop>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
#}
{% extends "@ChillMain/Password/recover_layout.html.twig" %}
{% block title %}{{"Recover password"|trans}}{% endblock %}
{% block content %}
<div class="grid-10 grid-mobile-10 grid-tablet-10 centered">
<h1>{{ 'Recover password'|trans }}</h1>
{{ form_start(form) }}
{{ form_row(form.username_or_email) }}
<ul class="record_actions">
<li>
{{ form_widget(form.submit, { 'attr': { 'class': 'sc-button orange' } } ) }}
</li>
</ul>
{{ form_end(form) }}
</div>
{% endblock %}

View File

@@ -0,0 +1,15 @@
{% extends "@ChillMain/Password/recover_layout.html.twig" %}
{% block title "Check your email"|trans %}
{% block content %}
<div class="grid-10 grid-mobile-10 grid-tablet-10 centered">
<h1>{{ 'Check your email'|trans }}</h1>
<p>{{ 'An email has been sent to your address. Click on the link inside this email to confirm that you are the owner of this account.'|trans }}</p>
</div>
{% endblock %}