Commit 7d7c7583cad99cd347c86b2ee06fbd3eab059f96
1 parent
4a3e61f0
Exists in
master
and in
5 other branches
add app remeber password #58
Showing
8 changed files
with
188 additions
and
1 deletions
Show diff stats
amadeus/settings.py
... | ... | @@ -181,6 +181,14 @@ MESSAGE_TAGS = { |
181 | 181 | messages_constants.ERROR: 'danger', |
182 | 182 | } |
183 | 183 | |
184 | +#Send email for forgot Password | |
185 | +EMAIL_USE_TLS = True | |
186 | +EMAIL_HOST = 'smtp.gmail.com' | |
187 | +EMAIL_PORT = 25 | |
188 | +EMAIL_HOST_USER = 'amadeusteste@gmail.com' | |
189 | +EMAIL_HOST_PASSWORD = 'amadeusteste' | |
190 | +# EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend' | |
191 | + | |
184 | 192 | |
185 | 193 | try: |
186 | 194 | from .local_settings import * | ... | ... |
core/templates/index.html
... | ... | @@ -59,7 +59,7 @@ |
59 | 59 | </div> |
60 | 60 | </form> |
61 | 61 | <div class="col-md-10 col-sm-10 col-xs-10 col-lg-10"> |
62 | - <a href="{% url 'core:remember_password' %}">{% trans "Forgot your password?" %}</a> | |
62 | + <a href="{% url 'core:password_reset' %}">{% trans "Forgot your password?" %}</a> | |
63 | 63 | </div> |
64 | 64 | {# </div> #} |
65 | 65 | {# <div class="row"> #} | ... | ... |
... | ... | @@ -0,0 +1,37 @@ |
1 | +{% extends "index.html" %} | |
2 | +{% load i18n static %} | |
3 | + | |
4 | +{% block content %} | |
5 | + | |
6 | + <div class="row"> | |
7 | + <div class="col-md-4 col-md-offset-4 col-xs-4 col-xs-offset-4 col-sm-4 col-sm-offset-4 col-lg-4 col-lg-offset-4 col-xl-4 col-xl-offset-4"> | |
8 | + <div class="row"> | |
9 | + <div class="col-md-offset-2 col-md-8 col-sm-offset-2 col-sm-8 col-xs-offset-2 col-xs-8 col-lg-offset-2 col-lg-8 col-xs-offset-2 col-xs-8"> | |
10 | + </br> | |
11 | + </br> | |
12 | + <img src="{% static 'img/amadeus.png' %}" class="img-responsive center-block " alt="logo amadeus"> | |
13 | + </br> | |
14 | + </div> | |
15 | + </div> | |
16 | + </div> | |
17 | + <div class="row "> | |
18 | + <div class="col-lg-9 col-lg-offset-2 col-xs-9 col-xs-offset-2 col-sm-9 col-sm-offset-2 col-md-9 col-md-offset-2 col-xl-9 col-xl-offset-2"> | |
19 | + <div class="card"> | |
20 | + <div class="card-block"> | |
21 | + <div class="col-md-12 col-xs-12 col-sm-12 col-lg-12 col-xl-12"> | |
22 | + <form class="form-group " method="post" action=""> | |
23 | + {% csrf_token %} | |
24 | + <div class="form-group is-empty"> | |
25 | + <p> | |
26 | + Sua senha foi definida. Você pode ir em frente e entrar agora. | |
27 | + </p> | |
28 | + </div> | |
29 | + </form> | |
30 | + </div> | |
31 | + </div> | |
32 | + </div> | |
33 | + </div> | |
34 | + </div> | |
35 | + </div> | |
36 | + | |
37 | +{% endblock content %} | ... | ... |
... | ... | @@ -0,0 +1,48 @@ |
1 | +{% extends "index.html" %} | |
2 | +{% load i18n static %} | |
3 | + | |
4 | +{% block content%} | |
5 | + | |
6 | + <div class="row"> | |
7 | + <div class="col-md-4 col-md-offset-4 col-xs-4 col-xs-offset-4 col-sm-4 col-sm-offset-4 col-lg-4 col-lg-offset-4 col-xl-4 col-xl-offset-4"> | |
8 | + <div class="row"> | |
9 | + <div class="col-md-offset-2 col-md-8 col-sm-offset-2 col-sm-8 col-xs-offset-2 col-xs-8 col-lg-offset-2 col-lg-8 col-xs-offset-2 col-xs-8"> | |
10 | + </br> | |
11 | + </br> | |
12 | + <img src="{% static 'img/amadeus.png' %}" class="img-responsive center-block " alt="logo amadeus"> | |
13 | + </br> | |
14 | + </div> | |
15 | + </div> | |
16 | + </div> | |
17 | + <div class="row "> | |
18 | + <div class="col-lg-9 col-lg-offset-2 col-xs-9 col-xs-offset-2 col-sm-9 col-sm-offset-2 col-md-9 col-md-offset-2 col-xl-9 col-xl-offset-2"> | |
19 | + | |
20 | + | |
21 | + {% if validlink %} | |
22 | + <h3>Nova Senha</h3> | |
23 | + <form method="post"> | |
24 | + {% csrf_token %} | |
25 | + {{ form.new_password1.erros }} | |
26 | + <label for="id_password1"> Nova Senha: </label> | |
27 | + {form.new_password1} | |
28 | + | |
29 | + {{ form.new_password2.erros }} | |
30 | + <label for="id_password2"> Confirmar Senha: </label> | |
31 | + {form.new_password2} | |
32 | + | |
33 | + | |
34 | + <button type="submit">Confirmar</button> | |
35 | + </form> | |
36 | + | |
37 | + {% else %} | |
38 | + <p> | |
39 | + O link de redefinição de senha está inválido, possivelmente porque ele já foi utilizado. | |
40 | + Por favor, solicite uma nova redefinição de senha. | |
41 | + </p> | |
42 | + {% endif %} | |
43 | + | |
44 | + </div> | |
45 | + </div> | |
46 | +</div> | |
47 | + | |
48 | +{% endblock content %} | ... | ... |
... | ... | @@ -0,0 +1,41 @@ |
1 | +{% extends "index.html" %} | |
2 | +{% load i18n static %} | |
3 | + | |
4 | +{% block content %} | |
5 | + | |
6 | + <div class="row"> | |
7 | + <div class="col-md-4 col-md-offset-4 col-xs-4 col-xs-offset-4 col-sm-4 col-sm-offset-4 col-lg-4 col-lg-offset-4 col-xl-4 col-xl-offset-4"> | |
8 | + <div class="row"> | |
9 | + <div class="col-md-offset-2 col-md-8 col-sm-offset-2 col-sm-8 col-xs-offset-2 col-xs-8 col-lg-offset-2 col-lg-8 col-xs-offset-2 col-xs-8"> | |
10 | + </br> | |
11 | + </br> | |
12 | + <img src="{% static 'img/amadeus.png' %}" class="img-responsive center-block " alt="logo amadeus"> | |
13 | + </br> | |
14 | + </div> | |
15 | + </div> | |
16 | + </div> | |
17 | + <div class="row "> | |
18 | + <div class="col-lg-9 col-lg-offset-2 col-xs-9 col-xs-offset-2 col-sm-9 col-sm-offset-2 col-md-9 col-md-offset-2 col-xl-9 col-xl-offset-2"> | |
19 | + <div class="card"> | |
20 | + <div class="card-block"> | |
21 | + <div class="col-md-12 col-xs-12 col-sm-12 col-lg-12 col-xl-12"> | |
22 | + <form class="form-group " method="post" action=""> | |
23 | + {% csrf_token %} | |
24 | + <div class="form-group is-empty"> | |
25 | + <p> | |
26 | + Temos enviado instruções para configurar sua senha, se uma conta existe com o e-mail inserido. | |
27 | + Você deve recebê-los em breve. | |
28 | + </p> | |
29 | + <p> | |
30 | + Se você não receber um e-mail, por favor, certifique-se de que introduziu o endereço que você registrou, | |
31 | + e verifique a pasta de spam. | |
32 | + </p> | |
33 | + </div> | |
34 | + </form> | |
35 | + </div> | |
36 | + </div> | |
37 | + </div> | |
38 | + </div> | |
39 | + </div> | |
40 | + | |
41 | +{% endblock %} | ... | ... |
... | ... | @@ -0,0 +1,14 @@ |
1 | +To initiate the password reset process for your {{ user.get_username }} TestSite Account, | |
2 | +click the link below: | |
3 | + | |
4 | +{% block reset_link %} | |
5 | +{{ protocol }}://{{ domain }}{% url 'core:passwor_reset_confirm' uidb36=uid token=token %} | |
6 | + | |
7 | +{% endblock %} | |
8 | + | |
9 | +If clicking the link above doesn't work, please copy and paste the URL in a new browser | |
10 | +window instead. | |
11 | + | |
12 | + | |
13 | +Sincerely, | |
14 | +Amadeus. | ... | ... |
... | ... | @@ -0,0 +1,32 @@ |
1 | +{% extends "index.html" %} | |
2 | +{% load i18n static %} | |
3 | + | |
4 | +{% block content %} | |
5 | + | |
6 | + <div class="row"> | |
7 | + < <div class="col-md-4 col-md-offset-4 col-xs-4 col-xs-offset-4 col-sm-4 col-sm-offset-4 col-lg-4 col-lg-offset-4 col-xl-4 col-xl-offset-4"> | |
8 | + <div class="row"> | |
9 | + <div class="col-md-offset-2 col-md-8 col-sm-offset-2 col-sm-8 col-xs-offset-2 col-xs-8 col-lg-offset-2 col-lg-8 col-xs-offset-2 col-xs-8"> | |
10 | + </br> | |
11 | + </br> | |
12 | + <img src="{% static 'img/amadeus.png' %}" class="img-responsive center-block " alt="logo amadeus"> | |
13 | + </br> | |
14 | + </div> | |
15 | + </div> | |
16 | + </div> | |
17 | + <div class="row "> | |
18 | + <div class="col-lg-9 col-lg-offset-2 col-xs-9 col-xs-offset-2 col-sm-9 col-sm-offset-2 col-md-9 col-md-offset-2 col-xl-9 col-xl-offset-2"> | |
19 | + | |
20 | + | |
21 | + <h3>Recuperar a senha</h3> | |
22 | + <form method="post"> | |
23 | + {% csrf_token %} | |
24 | + <label for="id_email">E-mail: </label> {{ form.email }} | |
25 | + <input type="submit" value="Enviar" /></p> | |
26 | + </form> | |
27 | + | |
28 | + </div> | |
29 | + </div> | |
30 | + </div> | |
31 | + | |
32 | +{% endblock content %} | ... | ... |
core/urls.py
1 | 1 | from django.conf.urls import url, include |
2 | 2 | from django.contrib.auth import views as auth_views |
3 | +from django.contrib.auth.views import password_reset, password_reset_done,password_reset_confirm, password_reset_complete | |
3 | 4 | |
4 | 5 | from . import views |
5 | 6 | |
... | ... | @@ -11,4 +12,10 @@ urlpatterns = [ |
11 | 12 | url(r'^logout/$', auth_views.logout, {'next_page': 'core:home'}, name='logout'), |
12 | 13 | url(r'^notification/([0-9]+)/$', views.processNotification, name='notification_read'), |
13 | 14 | url(r'^getNotifications/$', views.getNotifications, name='getNotifications'), |
15 | + | |
16 | + 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"), | |
17 | + url(r'^reset/done/$', password_reset_done, {'template_name':'registration/passwor_reset_done.html'}), | |
18 | + url(r'^reset/(?P<uidb36>[0-9A-Za-z]+)/(?P<token>[0-9A-Za-z]{1,13}-[0-9A-Za-z]{1,20})/$', password_reset_confirm, {'template_name':'registration/password_reset_confirm.html'}), | |
19 | + url(r'^done/$', password_reset_complete,{'template_name':'registration/passwor_reset_complete.html'}), | |
20 | + | |
14 | 21 | ] | ... | ... |