Commit 620d4e0a authored by GuiΩ's avatar GuiΩ
Browse files

Password change view

parent 0be05c89
......@@ -11,13 +11,12 @@ class UtilisateurCreationForm(UserCreationForm):
class UtilisateurChangeForm(UserChangeForm):
password = None
class Meta:
model = Utilisateur
fields = ('username', 'email', 'first_name', 'last_name', 'nom_latex')
def get_object(self):
return self.request.user
class ClasseForm(ModelForm):
class Meta:
......
......@@ -33,6 +33,10 @@ urlpatterns = [
path('', include('django.contrib.auth.urls')),
path('signup/', views.SignUpView.as_view(), name='signup'),
path('profile/', views.UserChangeView.as_view(), name='profile'),
path('password/', auth_views.PasswordChangeView.as_view(
template_name='registration/password_change.html',
success_url='/am/profile/'
), name='change_password'),
path('api/', include((router.urls, app_name))),
path('api/annee_list/', views.AnneeView.as_view()),
]
......@@ -38,7 +38,7 @@
<div class="right">
<button id="undo" :disabled="! hasUndoable" :title="undoMessage" @click="undo"></button>
<button id="redo" :disabled="! hasRedoable" :title="redoMessage" @click="redo"></button>
<span data-testid="username"><a href="./profile/">{{ getusername() }}</a></span>
<span data-testid="username"><a href="./profile/" title="Profile">{{ getusername() }}</a></span>
<a href="logout/">Déconnexion</a>
</div>
</div>
......
......@@ -2,6 +2,13 @@
{% extends 'base.html' %}
{% block title %} - Changement de mot de passe{% endblock %}
{% block head %}
<style>
th {
vertical-align: top;
}
</style>
{% endblock %}
{% block content %}
<h1>Activités Mentales</h1>
......@@ -9,9 +16,17 @@
{% if user.is_authenticated %}
<form method="post">
{% csrf_token %}
{{ form.as_p }}
<input type="submit" value="Valider">
<table>
{% csrf_token %}
{{ form.as_table }}
<tr>
<td></td>
<td>
<input type="submit" value="Valider">
<input onclick="window.location.href='/am/profile/';" type="button" value="Annuler"/>
</td>
</tr>
</table>
</form>
{% else %}
Non Authentifié
......
......@@ -12,14 +12,25 @@
{% block content %}
<h1>Activités Mentales</h1>
<a href="/am/">Retour à l'accueil</a>
<h2>Modifier mon profil</h2>
<form method="post">
<table>
{% csrf_token %}
{{ form.as_table }}
<tr>
<td></td>
<td>Les mots de passe ne sont pas enregistrés en clair, ce qui ne permet pas d’afficher le mot de passe de
cet utilisateur, mais il est possible de le changer en utilisant
<a href="/am/password/">ce formulaire</a>.
</td>
</tr>
<tr>
<td></td>
<td>
<input type="submit" value="Valider">
<input onclick="window.location.href='/am/';" type="button" value="Annuler"/>
</td>
</tr>
</table>
<button type="submit">Enregistrer</button>
</form>
{% endblock %}
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment