-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implementado fluxo com templates para login
- Loading branch information
Showing
15 changed files
with
213 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<!DOCTYPE html> | ||
<html lang="pt-br"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<title>{% block title %}Título Padrão{% endblock %}</title> | ||
</head> | ||
<body> | ||
{% block body %}{% endblock body %} | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{% extends 'base/base.html' %} | ||
{% block title %}Página de Template Django da DevPro{% endblock title %} | ||
|
||
{% block body %} | ||
<h1>Página de Template Django da DevPro</h1> | ||
<p>Essa página pode ser alterada de acordo com a home do seu projeto</p> | ||
<h2>Página Login</h2> | ||
<p>Esse projeto já veio com login do Django configurado:</p> | ||
{% if request.user.is_authenticated %} | ||
<a href="{% url 'password_change' %}">Alterar senha</a> | ||
<form action="{% url 'logout' %}" method="post"> | ||
{% csrf_token %} | ||
<input type="submit" value="Sair"> | ||
</form> | ||
|
||
{% else %} | ||
<a href="{% url 'login' %}">Página de Login</a> | ||
{% endif %} | ||
|
||
{% endblock body %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{% extends 'base/base.html' %} | ||
{% block title %}Página de Login{% endblock title %} | ||
{% block body %} | ||
<h1>Página de Login</h1> | ||
<form action="{% url 'login' %}" method="post"> | ||
{% csrf_token %} | ||
{{ form.as_p }} | ||
<input type="submit" value="Logar"> | ||
</form> | ||
<a href="{% url 'password_reset' %}">Esqueceu a senha</a> | ||
{% endblock body %} |
8 changes: 8 additions & 0 deletions
8
backend/devpro/base/templates/registration/password_change_done.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{% extends 'base/base.html' %} | ||
{% load i18n static %} | ||
{% block title %}Página de Recuperação de senha{% endblock title %} | ||
{% block body %} | ||
<h1>{% translate 'Password change' %}</h1> | ||
<p>{% translate 'Your password was changed.' %}</p> | ||
|
||
{% endblock body %} |
55 changes: 55 additions & 0 deletions
55
backend/devpro/base/templates/registration/password_change_form.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
{% extends 'base/base.html' %} | ||
{% load i18n static %} | ||
{% block title %}Página de Reset de senha{% endblock title %} | ||
{% block body %} | ||
<h1>Página de Alteração de senha</h1> | ||
<div id="content-main"> | ||
|
||
<form method="post">{% csrf_token %} | ||
<div> | ||
{% if form.errors %} | ||
<p class="errornote"> | ||
{% blocktranslate count counter=form.errors.items|length %}Please correct the error below. | ||
{% plural %}Please correct the errors below.{% endblocktranslate %} | ||
</p> | ||
{% endif %} | ||
|
||
|
||
<p>{% translate 'Please enter your old password, for security’s sake, and then enter your new password twice so we can verify you typed it in correctly.' %}</p> | ||
|
||
<fieldset class="module aligned wide"> | ||
|
||
<div class="form-row"> | ||
{{ form.old_password.errors }} | ||
<div class="flex-container">{{ form.old_password.label_tag }} {{ form.old_password }}</div> | ||
</div> | ||
|
||
<div class="form-row"> | ||
{{ form.new_password1.errors }} | ||
<div class="flex-container">{{ form.new_password1.label_tag }} {{ form.new_password1 }}</div> | ||
{% if form.new_password1.help_text %} | ||
<div class="help"{% if form.new_password1.id_for_label %} | ||
id="{{ form.new_password1.id_for_label }}_helptext"{% endif %}>{{ form.new_password1.help_text|safe }}</div> | ||
{% endif %} | ||
</div> | ||
|
||
<div class="form-row"> | ||
{{ form.new_password2.errors }} | ||
<div class="flex-container">{{ form.new_password2.label_tag }} {{ form.new_password2 }}</div> | ||
{% if form.new_password2.help_text %} | ||
<div class="help"{% if form.new_password2.id_for_label %} | ||
id="{{ form.new_password2.id_for_label }}_helptext"{% endif %}>{{ form.new_password2.help_text|safe }}</div> | ||
{% endif %} | ||
</div> | ||
|
||
</fieldset> | ||
|
||
<div class="submit-row"> | ||
<input type="submit" value="{% translate 'Change my password' %}" class="default"> | ||
</div> | ||
|
||
</div> | ||
</form> | ||
</div> | ||
|
||
{% endblock body %} |
10 changes: 10 additions & 0 deletions
10
backend/devpro/base/templates/registration/password_reset_complete.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{% extends 'base/base.html' %} | ||
{% load i18n static %} | ||
{% block title %}Página de Recuperação de senha{% endblock title %} | ||
{% block body %} | ||
<h1>{% translate 'Password reset' %}</h1> | ||
<p>{% translate "Your password has been set. You may go ahead and log in now." %}</p> | ||
|
||
<p><a href="{{ login_url }}">{% translate 'Log in' %}</a></p> | ||
|
||
{% endblock body %} |
37 changes: 37 additions & 0 deletions
37
backend/devpro/base/templates/registration/password_reset_confirm.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
{% extends 'base/base.html' %} | ||
{% load i18n static %} | ||
{% block title %}Página de Reset de Senha{% endblock title %} | ||
{% block body %} | ||
<h1>{% translate 'Password reset confirmation' %}</h1> | ||
{% if validlink %} | ||
|
||
<p>{% translate "Please enter your new password twice so we can verify you typed it in correctly." %}</p> | ||
|
||
<form method="post">{% csrf_token %} | ||
<input type="hidden" autocomplete="username" value="{{ form.user.get_username }}"> | ||
<div class="form-row field-password1"> | ||
{{ form.new_password1.errors }} | ||
<div class="flex-container"> | ||
<label for="id_new_password1">{% translate 'New password:' %}</label> | ||
{{ form.new_password1 }} | ||
</div> | ||
</div> | ||
<div class="form-row field-password2"> | ||
{{ form.new_password2.errors }} | ||
<div class="flex-container"> | ||
<label for="id_new_password2">{% translate 'Confirm password:' %}</label> | ||
{{ form.new_password2 }} | ||
</div> | ||
</div> | ||
<div class="submit-row"> | ||
<input type="submit" value="{% translate 'Change my password' %}"> | ||
</div> | ||
</form> | ||
|
||
{% else %} | ||
|
||
<p>{% translate "The password reset link was invalid, possibly because it has already been used. Please request a new password reset." %}</p> | ||
|
||
{% endif %} | ||
|
||
{% endblock body %} |
11 changes: 11 additions & 0 deletions
11
backend/devpro/base/templates/registration/password_reset_done.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{% extends 'base/base.html' %} | ||
{% load i18n static %} | ||
{% block title %}Página de Recuperação de senha{% endblock title %} | ||
{% block body %} | ||
<h1>{% translate 'Password reset' %}</h1> | ||
<p>{% translate 'We’ve emailed you instructions for setting your password, if an account exists with the email you entered. You should receive them shortly.' %}</p> | ||
|
||
<p>{% translate 'If you don’t receive an email, please make sure you’ve entered the address you registered with, and check your spam folder.' %}</p> | ||
|
||
|
||
{% endblock body %} |
21 changes: 21 additions & 0 deletions
21
backend/devpro/base/templates/registration/password_reset_form.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{% extends 'base/base.html' %} | ||
{% load i18n static %} | ||
{% block title %}Página de Recuperação de senha{% endblock title %} | ||
{% block body %} | ||
<h1>{% translate 'Password reset' %}</h1> | ||
<p>{% translate 'Forgotten your password? Enter your email address below, and we’ll email instructions for setting a new one.' %}</p> | ||
|
||
<form method="post">{% csrf_token %} | ||
<div> | ||
<p>{{ form.email.errors }}</p> | ||
<div> | ||
<label for="id_email">{% translate 'Email address:' %}</label> | ||
{{ form.email }} | ||
</div> | ||
</div> | ||
|
||
<input type="submit" value="{% translate 'Reset my password' %}"> | ||
|
||
</form> | ||
|
||
{% endblock body %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
def test_home_status(client): | ||
resp = client.get('/') | ||
assert resp.status_code == 200 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
from django.urls import reverse | ||
|
||
|
||
def test_login_page_status(client): | ||
resp = client.get(reverse('login')) | ||
assert resp.status_code == 200 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
from django.urls import path | ||
|
||
from devpro.base import views | ||
|
||
urlpatterns = [ | ||
path('', views.home, name='home'), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,7 @@ | ||
# from django.shortcuts import render | ||
from django.shortcuts import render | ||
|
||
|
||
# Create your views here. | ||
|
||
def home(request): | ||
return render(request, 'base/home.html') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters