Qwann/move user #13

Merged
narmanli merged 11 commits from qwann/move_user into master 2017-05-16 19:13:53 +02:00
27 changed files with 36 additions and 150 deletions
Showing only changes of commit 1f8339b4db - Show all commits

View file

@ -35,7 +35,7 @@ ALLOWED_HOSTS = []
INSTALLED_APPS = [ INSTALLED_APPS = [
'equipment.apps.EquipmentConfig', 'equipment.apps.EquipmentConfig',
'event.apps.EventConfig', 'event.apps.EventConfig',
'user.apps.UserConfig', 'users.apps.UsersConfig',
'shared.apps.SharedConfig', 'shared.apps.SharedConfig',
'django.contrib.admin', 'django.contrib.admin',
'django.contrib.auth', 'django.contrib.auth',

View file

@ -8,7 +8,7 @@ from django.contrib import admin
urlpatterns = [ urlpatterns = [
url(r'^admin/', admin.site.urls), url(r'^admin/', admin.site.urls),
url(r'^event/', include('event.urls')), url(r'^event/', include('event.urls')),
url(r'^user/', include('user.urls')), url(r'^user/', include('users.urls')),
url(r'^', include('shared.urls')), url(r'^', include('shared.urls')),
] ]

View file

@ -20,19 +20,19 @@
{% block sidenav %} {% block sidenav %}
{% if not user.is_authenticated %} {% if not user.is_authenticated %}
<li> <li>
<a href="{% url "user:login" %}"> <a href="{% url "users:login" %}">
<i class="fa fa-sign-in"></i> <i class="fa fa-sign-in"></i>
<span>Se connecter</span> <span>Se connecter</span>
</a> </a>
</li> </li>
<li> <li>
<a href="{% url "user:create_user" %}"> <a href="{% url "users:create_user" %}">
<i class="fa fa-user"></i> <i class="fa fa-user"></i>
<span>Créer un compte</span> <span>Créer un compte</span>
</a> </a>
</li> </li>
<li> <li>
<a href="{% url "user:password_reset" %}"> <a href="{% url "users:password_reset" %}">
<i class="fa fa-question"></i> <i class="fa fa-question"></i>
<span>Mot de passe oublié</span> <span>Mot de passe oublié</span>
</a> </a>
@ -40,13 +40,13 @@
{% endif %} {% endif %}
{% if user.is_authenticated %} {% if user.is_authenticated %}
<li> <li>
<a href="{% url "user:password_change" %}"> <a href="{% url "users:password_change" %}">
<i class="fa fa-unlock-alt"></i> <i class="fa fa-unlock-alt"></i>
<span>Changer de mot de passe</span> <span>Changer de mot de passe</span>
</a> </a>
</li> </li>
<li> <li>
<a href="{% url "user:logout"%}"> <a href="{% url "users:logout"%}">
<i class="fa fa-sign-out"></i> <i class="fa fa-sign-out"></i>
<span>Se déconnecter</span> <span>Se déconnecter</span>
</a> </a>

View file

@ -69,10 +69,10 @@
<ul class="dropdown-menu dropdown-user"> <ul class="dropdown-menu dropdown-user">
<li><a href="#"><i class="fa fa-user fa-fw"></i>Mon profile</a> <li><a href="#"><i class="fa fa-user fa-fw"></i>Mon profile</a>
</li> </li>
<li><a href="{% url "user:password_change" %}"><i class="fa fa-unlock-alt fa-fw"></i>Changer de mot de passe</a> <li><a href="{% url "users:password_change" %}"><i class="fa fa-unlock-alt fa-fw"></i>Changer de mot de passe</a>
</li> </li>
<li class="divider"></li> <li class="divider"></li>
<li><a href="{% url "user:logout" %}"><i class="fa fa-sign-out fa-fw"></i>Se déconnecter</a> <li><a href="{% url "users:logout" %}"><i class="fa fa-sign-out fa-fw"></i>Se déconnecter</a>
</li> </li>
</ul> </ul>
<!-- /.dropdown-user --> <!-- /.dropdown-user -->
@ -80,7 +80,7 @@
<!-- /.dropdown --> <!-- /.dropdown -->
{% else %} {% else %}
<li> <li>
<a href="{% url "user:login" %}"> <a href="{% url "users:login" %}">
<i class="fa fa-sign-in fa-fw fa-lg"></i></a> <i class="fa fa-sign-in fa-fw fa-lg"></i></a>
</li> </li>
{% endif %} {% endif %}

View file

@ -1,5 +0,0 @@
from django.apps import AppConfig
class UserConfig(AppConfig):
name = 'user'

View file

@ -1,26 +0,0 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.9.6 on 2016-06-14 22:17
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
operations = [
migrations.CreateModel(
name='Profil',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('user', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
],
),
]

View file

@ -1,35 +0,0 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.9.6 on 2016-06-16 16:03
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('user', '0001_initial'),
]
operations = [
migrations.AddField(
model_name='profil',
name='modif_pad',
field=models.BooleanField(default=False, verbose_name='Modifier tous les pads'),
),
migrations.AddField(
model_name='profil',
name='read_kholle',
field=models.BooleanField(default=False, verbose_name='Lecture de khôlles'),
),
migrations.AddField(
model_name='profil',
name='write_kholle',
field=models.BooleanField(default=False, verbose_name='Écriture de khôlles'),
),
migrations.AddField(
model_name='profil',
name='write_pad',
field=models.BooleanField(default=False, verbose_name='Écrire des pads'),
),
]

View file

@ -1,31 +0,0 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.9.6 on 2016-06-23 14:03
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('user', '0002_auto_20160616_1803'),
]
operations = [
migrations.RemoveField(
model_name='profil',
name='modif_pad',
),
migrations.RemoveField(
model_name='profil',
name='read_kholle',
),
migrations.RemoveField(
model_name='profil',
name='write_kholle',
),
migrations.RemoveField(
model_name='profil',
name='write_pad',
),
]

View file

@ -1,22 +0,0 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.9.6 on 2016-06-23 16:08
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('user', '0003_auto_20160623_1603'),
]
operations = [
migrations.RemoveField(
model_name='profil',
name='user',
),
migrations.DeleteModel(
name='Profil',
),
]

View file

@ -1,4 +0,0 @@
{% extends "user/user_form.html" %}
{% block action_name %}{% url 'user:password_change' %}{% endblock %}
{% block user_error %}Une erreur s'est produite, veuillez réessayer.{% endblock %}

View file

@ -1,4 +0,0 @@
{% extends "user/user_form.html" %}
{% block action_name %}{% url 'user:password_reset' %}{% endblock %}
{% block user_error %}L'identitfiant et le mot de passe ne correspondent pas !{% endblock %}

View file

@ -1 +0,0 @@
[Qwann.fr] Réinitialisation du mot de passe

5
users/apps.py Normal file
View file

@ -0,0 +1,5 @@
from django.apps import AppConfig
class UsersConfig(AppConfig):
name = 'users'

View file

@ -0,0 +1,4 @@
{% extends "users/user_form.html" %}
{% block action_name %}{% url 'users:password_change' %}{% endblock %}
{% block user_error %}Une erreur s'est produite, veuillez réessayer.{% endblock %}

View file

@ -1,6 +1,6 @@
Bonjour, Bonjour,
Quelqu'un a demandé à réinitialiser le mot de passe pour le compte utilisateur de qwann.fr utilisant l'adresse mail : {{ email }}. Pour réinitialiser le mot de passe, veuillez suivre le lien suivant : Quelqu'un a demandé à réinitialiser le mot de passe pour le compte utilisateur de qwann.fr utilisant l'adresse mail : {{ email }}. Pour réinitialiser le mot de passe, veuillez suivre le lien suivant :
{{ protocol}}://qwann.fr{% url 'user:password_reset_confirm' uidb64=uid token=token %} {{ protocol}}://qwann.fr{% url 'users:password_reset_confirm' uidb64=uid token=token %}
Merci de ne pas répondre à ce mail. Merci de ne pas répondre à ce mail.

View file

@ -1,6 +1,6 @@
{% extends "user/user_form.html" %} {% extends "users/user_form.html" %}
{% block action_name %}{% url 'user:login' %}{% endblock %} {% block action_name %}{% url 'users:login' %}{% endblock %}
{% block user_error %}L'identitfiant et le mot de passe ne correspondent pas !{% endblock %} {% block user_error %}L'identitfiant et le mot de passe ne correspondent pas !{% endblock %}
{% block extra_form_input %} {% block extra_form_input %}

View file

@ -0,0 +1,4 @@
{% extends "users/user_form.html" %}
{% block action_name %}{% url 'users:password_reset' %}{% endblock %}
{% block user_error %}L'identitfiant et le mot de passe ne correspondent pas !{% endblock %}

View file

@ -0,0 +1 @@
[Évenementiel] Réinitialisation du mot de passe

View file

@ -2,16 +2,16 @@ from django.conf.urls import url
from django.contrib.auth import views as auth_views from django.contrib.auth import views as auth_views
from django.core.urlresolvers import reverse_lazy from django.core.urlresolvers import reverse_lazy
from shared.views import Home from shared.views import Home
from user.views import CreateUser from users.views import CreateUser
app_name = 'user' app_name = 'users'
urlpatterns = [ urlpatterns = [
# CREATE USER # CREATE USER
url('^create/$', CreateUser.as_view(), name='create_user'), url('^create/$', CreateUser.as_view(), name='create_user'),
# LOGIN # LOGIN
url('^login/$', url('^login/$',
auth_views.login, auth_views.login,
{'template_name': 'user/login.html', {'template_name': 'users/login.html',
'extra_context': { 'extra_context': {
'page_title': 'Connexion', 'page_title': 'Connexion',
'button': 'Se connecter', 'button': 'Se connecter',
@ -28,7 +28,7 @@ urlpatterns = [
# PASSWORD_CHANGE # PASSWORD_CHANGE
url('^password_change/$', url('^password_change/$',
auth_views.password_change, auth_views.password_change,
{'template_name': 'user/change_pass.html', {'template_name': 'users/change_pass.html',
'post_change_redirect': reverse_lazy('shared:home'), 'post_change_redirect': reverse_lazy('shared:home'),
'extra_context': { 'extra_context': {
'page_title': 'Changement de mot de passe', 'page_title': 'Changement de mot de passe',
@ -40,10 +40,10 @@ urlpatterns = [
# RESET PASSWORD # RESET PASSWORD
url('^password_reset/$', url('^password_reset/$',
auth_views.password_reset, auth_views.password_reset,
{'template_name': 'user/password_reset.html', {'template_name': 'users/password_reset.html',
'email_template_name': 'email_password_reset.html', 'email_template_name': 'email_password_reset.html',
'subject_template_name': 'subject_password_reset.txt', 'subject_template_name': 'subject_password_reset.txt',
'post_reset_redirect': reverse_lazy('user:password_reset_done'), 'post_reset_redirect': reverse_lazy('users:password_reset_done'),
'extra_context': { 'extra_context': {
'page_title': 'Demander un nouveau mot de passe', 'page_title': 'Demander un nouveau mot de passe',
'button': 'Envoyer' 'button': 'Envoyer'
@ -58,7 +58,7 @@ urlpatterns = [
url('^reset/(?P<uidb64>[0-9A-Za-z_\-]+)/(?P<token>[0-9A-Za-z]{1,13}-[0-9A-Za-z]{1,20})/$', url('^reset/(?P<uidb64>[0-9A-Za-z_\-]+)/(?P<token>[0-9A-Za-z]{1,13}-[0-9A-Za-z]{1,20})/$',
auth_views.password_reset_confirm, auth_views.password_reset_confirm,
{ {
'template_name': 'user/user_form.html', 'template_name': 'users/user_form.html',
'post_reset_redirect': reverse_lazy('user:password_reset_complete'), 'post_reset_redirect': reverse_lazy('user:password_reset_complete'),
'extra_context': { 'extra_context': {
'page_title': 'Changer de mot de passe', 'page_title': 'Changer de mot de passe',

View file

@ -1,10 +1,10 @@
from user.forms import CreateUserForm from .forms import CreateUserForm
from django.views.generic.edit import CreateView from django.views.generic.edit import CreateView
from django.contrib.messages.views import SuccessMessageMixin from django.contrib.messages.views import SuccessMessageMixin
from django.core.urlresolvers import reverse_lazy from django.core.urlresolvers import reverse_lazy
class CreateUser(SuccessMessageMixin, CreateView): class CreateUser(SuccessMessageMixin, CreateView):
template_name = 'user/user_form.html' template_name = 'users/user_form.html'
form_class = CreateUserForm form_class = CreateUserForm
success_url = reverse_lazy('erkan:index') success_url = reverse_lazy('erkan:index')
success_message = "Votre compte utilisateur a été correctement créé !" success_message = "Votre compte utilisateur a été correctement créé !"