mirror of
https://github.com/AdrienHallet/HaitiWater.git
synced 2026-11-09 15:56:06 +00:00
Working on the change of password
This commit is contained in:
1 parent
71776d8047
commit
8b99264aef
7 files changed
+76
-43
No files matched your search
@@ -11,6 +11,13 @@ from django.contrib.contenttypes.models import ContentType
|
||||
from ..authentication.models import Profile
|
||||
from ..water_network.models import Zone
|
||||
|
||||
|
||||
def edit(request):
|
||||
print(request.POST)
|
||||
|
||||
return HttpResponse(status=200)
|
||||
|
||||
|
||||
@csrf_exempt #TODO : this is a hot fix for something I don't understand, remove to debug
|
||||
def connect(request):
|
||||
print("Connection !")
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
from django.contrib.auth.forms import PasswordChangeForm
|
||||
from django import forms
|
||||
|
||||
|
||||
class CustomPasswordChangeForm(PasswordChangeForm):
|
||||
old_password = forms.PasswordInput()
|
||||
new_password1 = forms.PasswordInput
|
||||
new_password2 = forms.PasswordInput
|
||||
@@ -0,0 +1,27 @@
|
||||
{% extends "base.html" %}
|
||||
{% load static %}
|
||||
|
||||
{% block page_name %}
|
||||
<script src="{% static "profileHandler.js"%}"></script>
|
||||
Profil de {{ user.get_username }}
|
||||
{% endblock %}
|
||||
|
||||
{% block page_content %}
|
||||
<div class="col-lg-12">
|
||||
<section class="panel">
|
||||
<header class="panel-heading">
|
||||
<div class="panel-actions">
|
||||
<a href="#" class="fa fa-caret-down"></a>
|
||||
</div>
|
||||
<h2 class="panel-title">Changer le mot de passe</h2>
|
||||
</header>
|
||||
<div class="panel-body">
|
||||
<form action="fait/">
|
||||
{% csrf_token %}
|
||||
{{ form.as_p }}
|
||||
<button type="submit">Modifier</button>
|
||||
</form>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
{% endblock %}
|
||||
@@ -0,0 +1,23 @@
|
||||
{% extends "base.html" %}
|
||||
{% load static %}
|
||||
|
||||
{% block page_name %}
|
||||
<script src="{% static "profileHandler.js"%}"></script>
|
||||
Profil de {{ user.get_username }}
|
||||
{% endblock %}
|
||||
|
||||
{% block page_content %}
|
||||
<div class="col-lg-12">
|
||||
<section class="panel">
|
||||
<header class="panel-heading">
|
||||
<div class="panel-actions">
|
||||
<a href="#" class="fa fa-caret-down"></a>
|
||||
</div>
|
||||
<h2 class="panel-title">Mot de passe bien modifié</h2>
|
||||
</header>
|
||||
<div class="panel-body">
|
||||
Votre mot de passe a bien été changé. Veuillez vous <a href="{% url 'login' %}">reconnecter</a>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
{% endblock %}
|
||||
@@ -17,7 +17,7 @@
|
||||
<h2 class="panel-title">Informations</h2>
|
||||
</header>
|
||||
<div class="panel-body">
|
||||
<form class="form-horizontal form-bordered" method="post">
|
||||
<form class="form-horizontal form-bordered" method="post" action="infos/">
|
||||
{% csrf_token %}
|
||||
<div class="form-group">
|
||||
<label class="col-md-3 control-label" for="input-username">Identifiant</label>
|
||||
@@ -63,47 +63,8 @@
|
||||
<div class="panel-actions">
|
||||
<a href="#" class="fa fa-caret-down"></a>
|
||||
</div>
|
||||
<h2 class="panel-title">Changer le mot de passe</h2>
|
||||
<h2 class="panel-title"><a href="changer-mot-de-passe/">Changer le mot de passe</a></h2>
|
||||
</header>
|
||||
<div class="panel-body">
|
||||
<form class="form-horizontal form-bordered" method="post">
|
||||
{% csrf_token %}
|
||||
<div class="form-group">
|
||||
<label class="col-md-3 control-label" for="input-current-password">Mot de passe actuel</label>
|
||||
<div class="col-md-6">
|
||||
<div class="input-group input-group-icon">
|
||||
<span class="input-group-addon">
|
||||
<span class="icon"><i class="fa fa-lock"></i></span>
|
||||
</span>
|
||||
<input id="input-current-password" type="password" name="old-password" class="form-control" value="{{ last_name }}" required>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-md-3 control-label" for="input-new-password">Nouveau mot de passe</label>
|
||||
<div class="col-md-6">
|
||||
<div class="input-group input-group-icon">
|
||||
<span class="input-group-addon">
|
||||
<span class="icon"><i class="fa fa-key"></i></span>
|
||||
</span>
|
||||
<input id="input-new-password" type="password" name="new-password" class="form-control" placeholder="Nouveau mot de passe" required>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-md-3 control-label" for="input-new-password">Confirmation</label>
|
||||
<div class="col-md-6">
|
||||
<div class="input-group input-group-icon">
|
||||
<span class="input-group-addon">
|
||||
<span class="icon"><i class="fa fa-key"></i></span>
|
||||
</span>
|
||||
<input id="input-new-password-confirm" type="password" name="new-password-confirm" class="form-control" placeholder="Nouveau mot de passe" required>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<input type="submit" class="btn pull-right" value="modifier">
|
||||
</form>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
{% endblock %}
|
||||
@@ -1,10 +1,16 @@
|
||||
from django.conf.urls import url
|
||||
from django.urls import path
|
||||
|
||||
from django.contrib.auth import views as auth_views
|
||||
from . import forms
|
||||
from . import views
|
||||
from . import exports
|
||||
|
||||
urlpatterns = [
|
||||
path('connect/', exports.connect, name='auth'),
|
||||
url(r'^editer/changer-mot-de-passe/$', auth_views.PasswordChangeView.as_view(template_name='password.html'),
|
||||
name="change"),
|
||||
url(r'^editer/changer-mot-de-passe/fait/$', auth_views.PasswordChangeDoneView.as_view(
|
||||
template_name='password_changed.html'), name="changedone"),
|
||||
path('editer/', views.profile, name='profile'),
|
||||
path('editer/infos/', exports.edit, name='profile'),
|
||||
path('', views.index, name='auth'),
|
||||
]
|
||||
@@ -38,5 +38,6 @@ urlpatterns += [
|
||||
url(r'^login/$', auth_views.LoginView.as_view(template_name='authentication.html'),
|
||||
name='login'),
|
||||
url(r'^logout/$', auth_views.LogoutView.as_view(), name='logout'),
|
||||
url(r'^login/recuperer-mot-de-passe/$', auth_views.PasswordResetView.as_view(), name="reset"),
|
||||
url(r'^admin/', admin.site.urls),
|
||||
]
|
||||
Reference in new issue
Block a user