From 43a9159138c19fde596c556d8a1895bb8101fc25 Mon Sep 17 00:00:00 2001 From: Lucas <lucas.roussel@ensiie.fr> Date: Sun, 10 Dec 2017 23:24:56 +0100 Subject: [PATCH] oubli de mot de passe, pas fini --- .../__pycache__/__init__.cpython-35.pyc | Bin 149 -> 149 bytes .../__pycache__/settings.cpython-35.pyc | Bin 2402 -> 2402 bytes .../__pycache__/urls.cpython-35.pyc | Bin 1022 -> 1022 bytes .../__pycache__/wsgi.cpython-35.pyc | Bin 579 -> 579 bytes Projet/db.sqlite3 | Bin 66560 -> 66560 bytes .../polls/__pycache__/__init__.cpython-35.pyc | Bin 143 -> 143 bytes Projet/polls/__pycache__/admin.cpython-35.pyc | Bin 527 -> 527 bytes Projet/polls/__pycache__/apps.cpython-35.pyc | Bin 428 -> 428 bytes Projet/polls/__pycache__/forms.cpython-35.pyc | Bin 1793 -> 2019 bytes .../polls/__pycache__/models.cpython-35.pyc | Bin 2885 -> 2885 bytes Projet/polls/__pycache__/urls.cpython-35.pyc | Bin 1262 -> 1408 bytes Projet/polls/__pycache__/views.cpython-35.pyc | Bin 9979 -> 10799 bytes Projet/polls/forms.py | 4 ++ .../__pycache__/__init__.cpython-35.pyc | Bin 154 -> 154 bytes Projet/polls/templates/polls/connexion.html | 5 +- .../templates/polls/forgotten_passwd.html | 45 ++++++++++++++++++ Projet/polls/urls.py | 2 + Projet/polls/views.py | 28 +++++++++++ 18 files changed, 83 insertions(+), 1 deletion(-) create mode 100644 Projet/polls/templates/polls/forgotten_passwd.html diff --git a/Projet/ChandelIIEr/__pycache__/__init__.cpython-35.pyc b/Projet/ChandelIIEr/__pycache__/__init__.cpython-35.pyc index 54fb1c3de038b2712b5d4eb77e7ce2d64f198dac..9a1d86571131aa3296dc99d4a4e8e15e2ea6b5d2 100644 GIT binary patch delta 15 WcmbQrIF*rIjF*?|`eNOQ?0o<o{RBGz delta 15 WcmbQrIF*rIjF*>7tATSOdmjK8umeW` diff --git a/Projet/ChandelIIEr/__pycache__/settings.cpython-35.pyc b/Projet/ChandelIIEr/__pycache__/settings.cpython-35.pyc index 27d58475b32e561728b609b09fc540bdb88cee52..d64aa55e566b7565570f752f1d0bc02b87c95c66 100644 GIT binary patch delta 16 XcmaDP^hk(ZjF*?|`eNOU?9rS6Ej<M7 delta 16 XcmaDP^hk(ZjF*>7tATSPdo(8iCj0~W diff --git a/Projet/ChandelIIEr/__pycache__/urls.cpython-35.pyc b/Projet/ChandelIIEr/__pycache__/urls.cpython-35.pyc index 40e4484b4621d709f9ba3eca3ddf780bd1f25731..fbdda2dcc73d3769db05a16b2669450c24d9e920 100644 GIT binary patch delta 16 Xcmeyz{*RqqjF*?|`eNOU?BAIIFoOl9 delta 16 Xcmeyz{*RqqjF*>7tATSP`*&slDnbOY diff --git a/Projet/ChandelIIEr/__pycache__/wsgi.cpython-35.pyc b/Projet/ChandelIIEr/__pycache__/wsgi.cpython-35.pyc index 926ab7106017f86c7d3640b44a72d5ff19341f3c..71ee8ccf185b3cd94ee231d5d8503e1e951eaf02 100644 GIT binary patch delta 16 XcmX@ia+rl(jF*?|`eNOU>^4jQC(Z<I delta 16 XcmX@ia+rl(jF*>7tATSPyA2ZnA&moh diff --git a/Projet/db.sqlite3 b/Projet/db.sqlite3 index c33f2f5f4e98550092e4c6f1fe111dc3a916f94a..5a8f6600885399a4ec9924154507dfcebce1e621 100644 GIT binary patch delta 272 zcmZqZU}@-JnIO%0f1->t<Nb{Zo8+08-8T!e1Tk+;Q(nQr#Qbfupv*gFF*9Z^1_lOJ zW)BAD?aaB%lbAi2?=UNG7GyDD-t1vKO(-bHpu*p;(6y?x#3)K7udFP?IVZ#<*vY*- zs<<*R(LJmvFQ}rzG`uLOKtC(bC9A^EJG3C8GC$ka$iUEC*U(7U&_Kb+$jZpr%D_U; z(9qb_aI=A17o!kV*ucujOwZET+|s~g^BH&hj?FSMPnahwun0~%!ph0u#=vxlv4z2H zvLK7a=9Y&JjGNo8R&(((wlFY(<rv%;TflN|59}CO7#JAsHVd*?F>*9nv#|QMusTjI MG*;OB>XDct0ATn{?f?J) delta 256 zcmZqZU}@-JnIO%0bfSzi<I#-?o8&hOvV<^iPE%gNv6=D02WAm7CN2gB23BSd2IlR| zxy+N8J(%xo7GyDF-t1vKO(@7Xy|60FFe;@iAk<x@B-P(Dy(A|msL0qk&r91oH#xD& zBGtvWEU>I1$uTm|ASENvzsw-X*EreM$iUEC*U(7Uz(m2&z{=Fn%E(;L+|<m-a<hS3 z7o(7YiGqQJm9d4DsimHQp^2r1(dIMm_8qMH3=9mKV3$qOVBun7Y++zJ#Mr{%wpoy+ zjB#_z)mkoI1_lOZ1~&%A7N$cCZj%LBEH=A6uw&fpcEy2_jfK^>h1GF#p|Qf|SC7OL E0o?{kh5!Hn diff --git a/Projet/polls/__pycache__/__init__.cpython-35.pyc b/Projet/polls/__pycache__/__init__.cpython-35.pyc index 7fc2b92f6dbc34c31ebc253f26ae00f0dc91cc7f..19e8f865e34f4ace801a305210972b92f763381e 100644 GIT binary patch delta 15 WcmeBY>}O;b<K^YLzF2o6dj|j=PXs9d delta 15 WcmeBY>}O;b<K^YjYT%s6-T?p@0s}Pw diff --git a/Projet/polls/__pycache__/admin.cpython-35.pyc b/Projet/polls/__pycache__/admin.cpython-35.pyc index 411c08fe7870a8971c3ba3845bab2e7466254b35..1c222697a252ec7b0b23f3cd28db618c7f165663 100644 GIT binary patch delta 16 XcmeBY>1SaV<K^YLzF2o7I|ma0Ax;C) delta 16 XcmeBY>1SaV<K^YjYT(?+&cOr#8w~>8 diff --git a/Projet/polls/__pycache__/apps.cpython-35.pyc b/Projet/polls/__pycache__/apps.cpython-35.pyc index 12024cec0ddbe96bebcc5c6011b32acd8ad4ff0b..fbc5ca641b5b73ef676a4e34584adf230bb76f9b 100644 GIT binary patch delta 16 XcmZ3(yoQ-wjF*?|`eNOU>`NH|CD8<> delta 16 XcmZ3(yoQ-wjF*>7tATSP`%*>#ACLpF diff --git a/Projet/polls/__pycache__/forms.cpython-35.pyc b/Projet/polls/__pycache__/forms.cpython-35.pyc index 65d4b7f2d0b4394815cead2f2ea0c5ad7786dc43..1ff7aa6b41a6cadb6b8a97c73eee0676316b51ce 100644 GIT binary patch delta 267 zcmZqVd(5va#>>mKcfD@Ze>Mh&#|%h-g@J*=fq{XcxMHGmoV<Gq2SW-cLkk0lOl4%q zVq$1!W{6^ANa11#*5uyUuE92WBa0ZL;pG3UqV>%T3{k8Msmu&nYz!%kU<NxwGXrB3 z2SW-IL$D_EEn&C(qV)WdlGMC_#Ny)e6u11M+#-;bewv&`91IK$MVugl3q&x12t5#? z4<fihgaHEs!!72#)bb)V5EntHGcYhn6&W)yFlc}r4>FR6k%tj1;-|?zc@vv5qw(a6 RY-&6pTLhRSr6k!USpevnFO2{I delta 77 zcmaFN-^iyd#>>lfJx?X7g^hvXF#{4{VPIfzU|?V<j-RL;$Ckpu5Uk0$ae)RKv!5p0 X<X(2=$y?c#xY!sN7zCIkr6kz_D!L6_ diff --git a/Projet/polls/__pycache__/models.cpython-35.pyc b/Projet/polls/__pycache__/models.cpython-35.pyc index e1149c93c90c864a8bc9d4c13fa5b847067f64c2..367b7cf8c82b8e70040f79e41b57de8f0770792d 100644 GIT binary patch delta 16 XcmX>qc2taAjF*?|`eNOU>~`D$Dh~vp delta 16 XcmX>qc2taAjF*?oKTTyLyB#+GB)kLC diff --git a/Projet/polls/__pycache__/urls.cpython-35.pyc b/Projet/polls/__pycache__/urls.cpython-35.pyc index dfdc90427abe6ffb2d3d849494bbbf9eda0da9b6..ec50b3b08cd9b5fc4231125056ae3ac151acec9a 100644 GIT binary patch delta 259 zcmaFI*}$zV#>>lfVvTN;I2!}QV+JH3!N9=az`(#zd~T!iTt>50MurqkhE!&TEHQ=@ zR)!QUhGr&4kf1hLP#i3%0}@OZVTh7oNYP~o*3{d4hEb3)QYbDhzbHMwq$D*jz96x< zxI9JWmH@g?m1JCQVqRi;YCO7($}MpmGMn!(@iH<>PJYE)p-=>JaFHYf1H&!u(xRM# q#FCQKqP*gj3`MdG3=BoGlPg$!c(fQ87zCIESVS2`87H4%Q33${#75cx delta 113 zcmZqRe#faS#>>l<EvFilz{<ezm;nihF)%PVFfcF_FWIO(mysu3h#^XhAw`oRSW|2B zH%39m&56uBjEv%w^H?gxZgH0u<rE~Al%y8r6|ZC{l4f9FD3YGc#_GeN#=yWJz$Cyj IIgV8c0PH*$ga7~l diff --git a/Projet/polls/__pycache__/views.cpython-35.pyc b/Projet/polls/__pycache__/views.cpython-35.pyc index c8aa3094274342976cb849659ac4bc653f439f55..0268405a220cdd0e5da4fcfa1f8f81a967241633 100644 GIT binary patch delta 977 zcmezEyFNr&jF*>7c(ZQQ76S%`#|%h-iGhK^fq{Xc_|8V<V~o-%W(+M13{lz)Ddr3* z7GSmxLy9Fsu%^}KH;mV$C$D7n5SK2<&&es)Ps=Y#&o3!S&5JKcEG{ljnXD)wE+Fg% z6Agd}a!Fg-37{+846=~}<P1iBMt&w9rlJG}28LutkO%_<14xF2fq}spq-@9JDrqIg zEtBU;%hhMGGGwtaq_8m5Ff%kWFxIj%)UYxXm4nDEc7_@jhGs?v#u`?JEDnZd1_s6w zPKFd#kXUdE8$&H4LkSl{7B@o*J4mROjUk1Dp@xwmg_EI%i6N7Tp_ZMYgp;9$jUkJN zp@yBIhJm4(38XSOg@GYhlgrPos6K#!f#DW&UTS$!5Ca24sTl(ULs))EQK~{-erZ{1 zVyQxIeu+X#ssboLQWX*vk}^~C6b`Q}IlNM#peVCgAvI4SIX}0cBsHW8M<D8Dl;q|V z#V{~16sa&UFlh1?#e>*tAi`zx2}xlQ=JeE(TRg?7C6HjxFG?v2pFB@SlMUp!qQuE( zWt1Gna})Ct(^KQo!+kd>K;=N8%*e*b&&b2b%gD<p%E-pZ%gDvZ#l*(Q&&0;a!&H<q zc>=5C<n2r$lf~o;gwKO?f#QULQ3e!S%tfhic{ceX;hPxpX`8#{1sVC$L9WgKhgo`2 z!DM+QNrfVi7$^l63xJ&=1h!lOVli`3`s8_vK9lto;{-o~3}pkW;b&xHEXtldPjQ9d zcQnx)sCxFvtCYe8|Dws}PClWcKiN?^ke8W}fuR_b))^R!@+Z$%E@I4^ETp2!&khm? zB{c?+9fe@^r7F5=c_5d|zzJE9A6UxrOHz428lVOhO+KMgEi8Z}Qp~`>;HRm(IZTzG z(E^mDi&8*lq=JYv5CQUiQ8tK`10r%kL_UZp1QA6bqImLTH8n=3$-C4HL^*gwc({1D Pc=&kOz>tN9m4^iY&-&P? delta 400 zcmZ1<^4nKgjF*>7T23{JO_zb;F#{4{Vqjo!U|?V<KC)5y7$bAArrBl|rfbrZ&ohNg zwoxn)-VBoC0BK;9VdQ7xVJ?cFd{9;rEU%+fB)k_xK4J4lB|%2EL<R<iqNK?ul$BUP z%;S^aD@!saPOeoAo*bhRE_fBBj}2@tKO-AsQR?JcRiDWMsxgAM(PYvl*Q%}(e26BR zKKY%x{^WGEK;Gvd8IU&^7>hC|A5|-2%$RJUuFC%!B+df1fsL^!8?1h|x~^IV$YC;Y zLY9Gn;TB6-eo5*FkOrthIg{V1R||hZ63Jy?VDQt_-dv->&&VAQ(w+b!5+_g86c)$? lF|$EL4v5H|d{|SB(Qfi9O#?wL9xfg}9yTy!;bG-r0RWv^Q?dX6 diff --git a/Projet/polls/forms.py b/Projet/polls/forms.py index d0894cc..9354fe6 100644 --- a/Projet/polls/forms.py +++ b/Projet/polls/forms.py @@ -36,3 +36,7 @@ class InscriptionForm(forms.Form): class ConnexionForm(forms.Form): username = forms.CharField(max_length=50) passwd = forms.CharField(widget=forms.PasswordInput) + +class ForgottenPasswdForm(forms.Form): + mail = forms.EmailField() + new = forms.CharField(widget=forms.PasswordInput) \ No newline at end of file diff --git a/Projet/polls/migrations/__pycache__/__init__.cpython-35.pyc b/Projet/polls/migrations/__pycache__/__init__.cpython-35.pyc index af96c94827c6a3b4155d0042740fef20f6bb340b..42033b1523376a5fb5518db42917b553c3330f6c 100644 GIT binary patch delta 15 WcmbQmIE#^8jF*?|`eNOQ?2`c=js!{o delta 15 WcmbQmIE#^8jF*>7tATSO`(ywaK?7C* diff --git a/Projet/polls/templates/polls/connexion.html b/Projet/polls/templates/polls/connexion.html index 9b3f3df..920dfdc 100644 --- a/Projet/polls/templates/polls/connexion.html +++ b/Projet/polls/templates/polls/connexion.html @@ -39,7 +39,10 @@ Vous êtes connecté, {{ user.username }} ! </form> -<input class="button_submit"type="submit" value="Mot de passe oublié ?"/> +<form method="post" action="/polls/forgotten_passwd"> + {% csrf_token %} + <input class="button_submit"type="submit" value="Mot de passe oublié ?"/> +</form> {% endif %} diff --git a/Projet/polls/templates/polls/forgotten_passwd.html b/Projet/polls/templates/polls/forgotten_passwd.html new file mode 100644 index 0000000..ed25b72 --- /dev/null +++ b/Projet/polls/templates/polls/forgotten_passwd.html @@ -0,0 +1,45 @@ +<!DOCTYPE html> +{% load static %} +<html lang="en"> +<head> + <meta charset="UTF-8"> + <title>Mot de passe oublié</title> +</head> + +<link rel="stylesheet" type="text/css" href="{% static 'polls/style.css' %}" /> + +<body> + +{% if user.is_authenticated %} + +Vous êtes connecté, {{ user.username }} ! + +{% else %} + +<form method="post" action="/polls/manage_forgotten_passwd"> + + {% csrf_token %} + <h2 class="inscription-title-block">Mot de passe oublié</h2> + <div class="inscription-block"> + <h3 class="inscription-data">Adresse mail liée au compte</h3> + {% if error %} + <p><strong>Adresse mail invalide</strong></p> + {% endif %} + <div class="inscription-form"> + <br/> + {{ form.mail }} + </div> + <h3 class="inscription-data">Choisissez un nouveau mot de passe</h3> + <div class="inscription-form"> + <br/> + {{ form.new }} + </div> + </div> + <input class="button_submit" type="submit" value="Envoyez-moi un mail de confirmation" /> + +</form> + +{% endif %} + +</body> +</html> \ No newline at end of file diff --git a/Projet/polls/urls.py b/Projet/polls/urls.py index 1343c5e..78aaba6 100644 --- a/Projet/polls/urls.py +++ b/Projet/polls/urls.py @@ -13,6 +13,8 @@ urlpatterns = [ url(r'^connexion$', views.connexion, name='connexion'), url(r'^manage_connexion$', views.manage_connexion, name='manage_connexion'), url(r'^deconnexion$', views.deconnexion, name='deconnexion'), + url(r'^forgotten_passwd$', views.forgotten_passwd, name='forgotten_passwd'), + url(r'^manage_forgotten_passwd$', views.manage_forgotten_passwd, name='manage_forgotten_passwd'), url(r'^(?P<urlrapport>[0-9A-Za-z]+)/$',views.rapport,name='rapport'), # ex: /polls/5/ # url(r'^(?P<question_id>[0-9]+)/$', views.detail, name='detail'), diff --git a/Projet/polls/views.py b/Projet/polls/views.py index b11af0c..21cf423 100644 --- a/Projet/polls/views.py +++ b/Projet/polls/views.py @@ -176,6 +176,34 @@ def deconnexion(request): logout(request) return redirect(reverse(connexion)) +def forgotten_passwd(request): + template = loader.get_template('polls/forgotten_passwd.html') + form = ForgottenPasswdForm(request.POST) + context = { + 'form': form, + } + return HttpResponse(template.render(context, request)) + +def manage_forgotten_passwd(request): + error = False + form = ForgottenPasswdForm(request.POST) + if form.is_valid(): + mail = form.cleaned_data['mail'] + new = form.cleaned_data['new'] + user = User.objects.get(email=mail) + if user: + user.set_password(new) + user.save() + return HttpResponse("Votre nouveau mot de passe a bien été pris en compte") + else: + error = True + template = loader.get_template('polls/forgotten_passwd.html') + context = { + 'error': error, + 'form': form, + } + return HttpResponse(template.render(context, request)) + def prof(request): latest_rapport_list = Rapport.objects.order_by('url')[:5] template = loader.get_template('polls/prof.html') -- GitLab