From 7d7c7583cad99cd347c86b2ee06fbd3eab059f96 Mon Sep 17 00:00:00 2001 From: ifac0 Date: Sat, 1 Oct 2016 11:58:08 -0300 Subject: [PATCH] add app remeber password #58 --- amadeus/settings.py | 8 ++++++++ core/templates/index.html | 2 +- core/templates/registration/passwor_reset_complete.html | 37 +++++++++++++++++++++++++++++++++++++ core/templates/registration/passwor_reset_confirm.html | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ core/templates/registration/passwor_reset_done.html | 41 +++++++++++++++++++++++++++++++++++++++++ core/templates/registration/passwor_reset_email.html | 14 ++++++++++++++ core/templates/registration/passwor_reset_form.html | 32 ++++++++++++++++++++++++++++++++ core/urls.py | 7 +++++++ 8 files changed, 188 insertions(+), 1 deletion(-) create mode 100644 core/templates/registration/passwor_reset_complete.html create mode 100644 core/templates/registration/passwor_reset_confirm.html create mode 100644 core/templates/registration/passwor_reset_done.html create mode 100644 core/templates/registration/passwor_reset_email.html create mode 100644 core/templates/registration/passwor_reset_form.html diff --git a/amadeus/settings.py b/amadeus/settings.py index 4a6da4b..a97c16c 100644 --- a/amadeus/settings.py +++ b/amadeus/settings.py @@ -181,6 +181,14 @@ MESSAGE_TAGS = { messages_constants.ERROR: 'danger', } +#Send email for forgot Password +EMAIL_USE_TLS = True +EMAIL_HOST = 'smtp.gmail.com' +EMAIL_PORT = 25 +EMAIL_HOST_USER = 'amadeusteste@gmail.com' +EMAIL_HOST_PASSWORD = 'amadeusteste' +# EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend' + try: from .local_settings import * diff --git a/core/templates/index.html b/core/templates/index.html index 5168b4a..c7372fc 100644 --- a/core/templates/index.html +++ b/core/templates/index.html @@ -59,7 +59,7 @@
- {% trans "Forgot your password?" %} + {% trans "Forgot your password?" %}
{# #} {#
#} diff --git a/core/templates/registration/passwor_reset_complete.html b/core/templates/registration/passwor_reset_complete.html new file mode 100644 index 0000000..c61cb0c --- /dev/null +++ b/core/templates/registration/passwor_reset_complete.html @@ -0,0 +1,37 @@ +{% extends "index.html" %} +{% load i18n static %} + +{% block content %} + +
+
+
+
+
+
+ logo amadeus +
+
+
+
+
+
+
+
+
+
+ {% csrf_token %} +
+

+ Sua senha foi definida. Você pode ir em frente e entrar agora. +

+
+
+
+
+
+
+
+
+ +{% endblock content %} diff --git a/core/templates/registration/passwor_reset_confirm.html b/core/templates/registration/passwor_reset_confirm.html new file mode 100644 index 0000000..a8e2d8c --- /dev/null +++ b/core/templates/registration/passwor_reset_confirm.html @@ -0,0 +1,48 @@ +{% extends "index.html" %} +{% load i18n static %} + +{% block content%} + +
+
+
+
+
+
+ logo amadeus +
+
+
+
+
+
+ + + {% if validlink %} +

Nova Senha

+
+ {% csrf_token %} + {{ form.new_password1.erros }} + + {form.new_password1} + + {{ form.new_password2.erros }} + + {form.new_password2} + + + +
+ + {% else %} +

+ O link de redefinição de senha está inválido, possivelmente porque ele já foi utilizado. + Por favor, solicite uma nova redefinição de senha. +

+ {% endif %} + +
+
+
+ +{% endblock content %} diff --git a/core/templates/registration/passwor_reset_done.html b/core/templates/registration/passwor_reset_done.html new file mode 100644 index 0000000..6587fee --- /dev/null +++ b/core/templates/registration/passwor_reset_done.html @@ -0,0 +1,41 @@ +{% extends "index.html" %} +{% load i18n static %} + +{% block content %} + +
+
+
+
+
+
+ logo amadeus +
+
+
+
+
+
+
+
+
+
+ {% csrf_token %} +
+

+ Temos enviado instruções para configurar sua senha, se uma conta existe com o e-mail inserido. + Você deve recebê-los em breve. +

+

+ Se você não receber um e-mail, por favor, certifique-se de que introduziu o endereço que você registrou, + e verifique a pasta de spam. +

+
+
+
+
+
+
+
+ +{% endblock %} diff --git a/core/templates/registration/passwor_reset_email.html b/core/templates/registration/passwor_reset_email.html new file mode 100644 index 0000000..65c725b --- /dev/null +++ b/core/templates/registration/passwor_reset_email.html @@ -0,0 +1,14 @@ +To initiate the password reset process for your {{ user.get_username }} TestSite Account, +click the link below: + +{% block reset_link %} +{{ protocol }}://{{ domain }}{% url 'core:passwor_reset_confirm' uidb36=uid token=token %} + +{% endblock %} + +If clicking the link above doesn't work, please copy and paste the URL in a new browser +window instead. + + +Sincerely, +Amadeus. diff --git a/core/templates/registration/passwor_reset_form.html b/core/templates/registration/passwor_reset_form.html new file mode 100644 index 0000000..f662845 --- /dev/null +++ b/core/templates/registration/passwor_reset_form.html @@ -0,0 +1,32 @@ +{% extends "index.html" %} +{% load i18n static %} + +{% block content %} + +
+ <
+
+
+
+
+ logo amadeus +
+
+
+
+
+
+ + +

Recuperar a senha

+
+ {% csrf_token %} + {{ form.email }} +

+
+ +
+
+
+ +{% endblock content %} diff --git a/core/urls.py b/core/urls.py index 032c1f7..fc240cb 100644 --- a/core/urls.py +++ b/core/urls.py @@ -1,5 +1,6 @@ from django.conf.urls import url, include from django.contrib.auth import views as auth_views +from django.contrib.auth.views import password_reset, password_reset_done,password_reset_confirm, password_reset_complete from . import views @@ -11,4 +12,10 @@ urlpatterns = [ url(r'^logout/$', auth_views.logout, {'next_page': 'core:home'}, name='logout'), url(r'^notification/([0-9]+)/$', views.processNotification, name='notification_read'), url(r'^getNotifications/$', views.getNotifications, name='getNotifications'), + + url(r'^reset/$', password_reset, {'template_name':'registration/passwor_reset_form.html','email_template_name':'registration/password_reset_email.html','post_reset_redirect':'done/'}, name="password_reset"), + url(r'^reset/done/$', password_reset_done, {'template_name':'registration/passwor_reset_done.html'}), + url(r'^reset/(?P[0-9A-Za-z]+)/(?P[0-9A-Za-z]{1,13}-[0-9A-Za-z]{1,20})/$', password_reset_confirm, {'template_name':'registration/password_reset_confirm.html'}), + url(r'^done/$', password_reset_complete,{'template_name':'registration/passwor_reset_complete.html'}), + ] -- libgit2 0.21.2