Skip to content

Commit

Permalink
Merge pull request #53 from FGA0138-MDS-Ajax/login
Browse files Browse the repository at this point in the history
lógica de recuperar conta finalizada
  • Loading branch information
CaioDuart3 authored Dec 6, 2024
2 parents e8a98af + 22556f3 commit 9173a3f
Show file tree
Hide file tree
Showing 6 changed files with 67 additions and 5 deletions.
Binary file modified mamutes/Users/__pycache__/views.cpython-312.pyc
Binary file not shown.
54 changes: 54 additions & 0 deletions mamutes/Users/templates/redefinirSenha.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
<!DOCTYPE html>
{% load static %}
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="{% static 'css/login.css' %}">
<title>Mamutes do Cerrado | Login</title>
</head>
<body>
<section class="container-central-login">
<a href="#">
<svg xmlns="http://www.w3.org/2000/svg" width="26" height="24" viewBox="0 0 26 24" fill="none">
<path d="M0.93934 10.9393C0.353553 11.5251 0.353553 12.4749 0.93934 13.0607L10.4853 22.6066C11.0711 23.1924 12.0208 23.1924 12.6066 22.6066C13.1924 22.0208 13.1924 21.0711 12.6066 20.4853L4.12132 12L12.6066 3.51472C13.1924 2.92893 13.1924 1.97918 12.6066 1.3934C12.0208 0.807612 11.0711 0.807612 10.4853 1.3934L0.93934 10.9393ZM26 10.5L2 10.5V13.5L26 13.5V10.5Z" fill="#808080"/>
</svg>
</a>
<div class="central-login-inputs">
<div class="apresentation-texts">
<div class="greeting-login">
<h2 class="greeting-login-h2">Olá, membro!</h2>
<h1 class="greeting-login-h1">Bem-vindo de <b class="greeting-login-h1-colorizer">volta</b>?</h1>
</div>
<h3 class="apresentation-text-h3">Redefina sua senha para recuperar seu login</h3>
</div>
<form class="form-login" action="{% url 'redefinirSenha' %}" method="POST">
{% csrf_token %}
<div class="form-login-inputs">
<div class="container-inputs">
<div class="inputs-box">
<p>Nova senha</p>
<div class="input-campo">
<input type="text" name="password" placeholder="Digite aqui">
<svg class="icon-input" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none">
<path fill-rule="evenodd" clip-rule="evenodd" d="M12 1.25C10.7402 1.25 9.53204 1.75044 8.64124 2.64124C7.75044 3.53204 7.24999 4.74022 7.24999 6C7.24999 7.25978 7.75044 8.46796 8.64124 9.35876C9.53204 10.2496 10.7402 10.75 12 10.75C13.2598 10.75 14.468 10.2496 15.3588 9.35876C16.2495 8.46796 16.75 7.25978 16.75 6C16.75 4.74022 16.2495 3.53204 15.3588 2.64124C14.468 1.75044 13.2598 1.25 12 1.25ZM8.74999 6C8.74999 5.13805 9.0924 4.3114 9.7019 3.7019C10.3114 3.09241 11.138 2.75 12 2.75C12.8619 2.75 13.6886 3.09241 14.2981 3.7019C14.9076 4.3114 15.25 5.13805 15.25 6C15.25 6.86195 14.9076 7.6886 14.2981 8.2981C13.6886 8.90759 12.8619 9.25 12 9.25C11.138 9.25 10.3114 8.90759 9.7019 8.2981C9.0924 7.6886 8.74999 6.86195 8.74999 6ZM12 12.25C9.687 12.25 7.55499 12.776 5.97599 13.664C4.41999 14.54 3.24999 15.866 3.24999 17.5V17.602C3.24899 18.764 3.24799 20.222 4.52699 21.264C5.15599 21.776 6.03699 22.141 7.22699 22.381C8.41899 22.623 9.974 22.75 12 22.75C14.026 22.75 15.58 22.623 16.774 22.381C17.964 22.141 18.844 21.776 19.474 21.264C20.753 20.222 20.751 18.764 20.75 17.602V17.5C20.75 15.866 19.58 14.54 18.025 13.664C16.445 12.776 14.314 12.25 12 12.25ZM4.74999 17.5C4.74999 16.649 5.37199 15.725 6.71099 14.972C8.02699 14.232 9.895 13.75 12.001 13.75C14.105 13.75 15.973 14.232 17.289 14.972C18.629 15.725 19.25 16.649 19.25 17.5C19.25 18.808 19.21 19.544 18.526 20.1C18.156 20.402 17.536 20.697 16.476 20.911C15.419 21.125 13.974 21.25 12 21.25C10.026 21.25 8.58 21.125 7.52399 20.911C6.46399 20.697 5.84399 20.402 5.47399 20.101C4.78999 19.544 4.74999 18.808 4.74999 17.5Z" fill="#717171"/>
</svg>
</div>
</div>
<div class="inputs-box">
<p>Confirme sua nova senha</p>
<div class="input-campo">
<input type="password" name="password" placeholder="Digite aqui">
<svg class="icon-input" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none">
<path d="M16.6643 9.95H16.4071V7.63571C16.4071 6.33994 15.8924 5.09724 14.9761 4.18099C14.0599 3.26474 12.8172 2.75 11.5214 2.75C10.2256 2.75 8.98294 3.26474 8.06669 4.18099C7.15045 5.09724 6.6357 6.33994 6.6357 7.63571V9.95H6.37856C5.62838 9.95 4.90892 10.248 4.37846 10.7785C3.848 11.3089 3.54999 12.0284 3.54999 12.7786V17.9214C3.54999 18.6716 3.848 19.3911 4.37846 19.9215C4.90892 20.452 5.62838 20.75 6.37856 20.75H16.6643C17.4145 20.75 18.1339 20.452 18.6644 19.9215C19.1948 19.3911 19.4928 18.6716 19.4928 17.9214V12.7786C19.4928 12.0284 19.1948 11.3089 18.6644 10.7785C18.1339 10.248 17.4145 9.95 16.6643 9.95ZM8.17856 7.63571C8.17856 6.74913 8.53075 5.89886 9.15766 5.27196C9.78457 4.64505 10.6348 4.29286 11.5214 4.29286C12.408 4.29286 13.2583 4.64505 13.8852 5.27196C14.5121 5.89886 14.8643 6.74913 14.8643 7.63571V9.95H8.17856V7.63571ZM17.95 17.9214C17.95 18.2624 17.8145 18.5894 17.5734 18.8306C17.3323 19.0717 17.0053 19.2071 16.6643 19.2071H6.37856C6.03757 19.2071 5.71054 19.0717 5.46942 18.8306C5.2283 18.5894 5.09284 18.2624 5.09284 17.9214V12.7786C5.09284 12.4376 5.2283 12.1106 5.46942 11.8694C5.71054 11.6283 6.03757 11.4929 6.37856 11.4929H16.6643C17.0053 11.4929 17.3323 11.6283 17.5734 11.8694C17.8145 12.1106 17.95 12.4376 17.95 12.7786V17.9214Z" fill="#717171"/>
</svg>
</div>
</div>
</div>
</div>
<button class="btn-login" type="submit">Redefinir senha</button>
</form>
</div>
</section>
</body>
</html>
13 changes: 10 additions & 3 deletions mamutes/Users/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def cadastro(request):
return render(request, 'cadastro.html')

def recuperarConta(request):
#no momento ele dá sinal de envio pelo console, ainda não está enviando para caixa postal

if request.method == 'GET':
return render(request, 'recuperarConta.html')
else:
Expand All @@ -50,12 +50,15 @@ def recuperarConta(request):
usuario = MembroEquipe.objects.get(email=email)
token = geradorToken.make_token(usuario)
username = usuario.username

send_mail(
subject="Redefinição de senha",
message=f"Uma requisição de redefinição de senha foi feita no site ABNT Model para a conta vinculada a este email, para prosseguir com a redefinição de senha basta acessar o seguinte link: http://127.0.0.1:8000/redefinir_senha/{username}/{token}. Caso a requisição não tenha sido feita por você por favor ignore este email.",
message=f"Uma requisição de redefinição de senha foi feita no site ABNT Model para a conta vinculada a este email, para prosseguir com a redefinição de senha basta acessar o seguinte link: http://127.0.0.1:8000/redefinir_senha/{username}/{token}. Caso a requisição não tenha sido feita por você, por favor ignore este email.",
from_email=settings.EMAIL_HOST_USER,
recipient_list=[email]
)


context = {
'mensagem': f'Enviamos um email de recuperação de conta para {email}, cheque em sua caixa postal.',
}
Expand All @@ -69,5 +72,9 @@ def recuperarConta(request):
return render(request, 'recuperarConta.html', context)

def redefinirSenha(request):
pass
if request.method == 'GET':
return render('redefinirSenha.html')
else:
return


Binary file modified mamutes/mamutes/__pycache__/settings.cpython-312.pyc
Binary file not shown.
4 changes: 2 additions & 2 deletions mamutes/mamutes/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,8 @@
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'


DEFAULT_AUTO_EMAIL = 'configurar email'
EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
DEFAULT_AUTO_EMAIL = '[email protected]'
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
EMAIL_HOST_USER = config('EMAIL_HOST_USER')
EMAIL_HOST_PASSWORD = config('EMAIL_HOST_PASSWORD')
EMAIL_USE_TLS = config('EMAIL_USE_TLS')
Expand Down
1 change: 1 addition & 0 deletions mamutes/mamutes/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@
path ('login/', views.login, name = 'login'),
path('cadastro/', views.cadastro, name = 'cadastro'),
path('recuperarConta/', views.recuperarConta, name = 'recuperarConta'),
path('redefinirSenha/', views.redefinirSenha, name = 'redefinirSenha'),
]

0 comments on commit 9173a3f

Please sign in to comment.