mirror of
https://github.com/welton89/RRBEC.git
synced 2026-04-05 21:45:41 +00:00
feat: login
This commit is contained in:
BIN
gestaoRaul/login/__pycache__/urls.cpython-313.pyc
Normal file
BIN
gestaoRaul/login/__pycache__/urls.cpython-313.pyc
Normal file
Binary file not shown.
BIN
gestaoRaul/login/__pycache__/views.cpython-313.pyc
Normal file
BIN
gestaoRaul/login/__pycache__/views.cpython-313.pyc
Normal file
Binary file not shown.
@@ -1,13 +1,32 @@
|
||||
<!DOCTYPE html>
|
||||
{% load static %}
|
||||
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<title>Login</title>
|
||||
</head>
|
||||
<body>
|
||||
<form method="post">
|
||||
{% csrf_token %}
|
||||
{{ form.as_p }}
|
||||
<button type="submit">Entrar</button>
|
||||
</form>
|
||||
</body>
|
||||
<head>
|
||||
<Title>Login Form</Title>
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1.0">
|
||||
<link rel="stylesheet" href="{% static 'pico.css' %}">
|
||||
|
||||
<link rel="stylesheet" href="{% static 'login/css/login.css' %}">
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<div class="c-form">
|
||||
<h2>
|
||||
<img src="{% static 'midia/logo.png' %}" width="140px">
|
||||
</h2>
|
||||
<div class="c-input">
|
||||
<form method="post" class="c-inputBox">
|
||||
{% csrf_token %}
|
||||
{{ form.as_p }}
|
||||
<div class="c-inputBox">
|
||||
<input type="submit" name="" value="Entrar">
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<!-- <p class="forgot">Forgot Password? <a href="#">Click Here</a></p> -->
|
||||
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -3,4 +3,5 @@ from . import views
|
||||
|
||||
urlpatterns = [
|
||||
path('', views.login_view, name='login'),
|
||||
path('logout', views.logout_view, name='logout'),
|
||||
]
|
||||
@@ -1,7 +1,13 @@
|
||||
from django.shortcuts import render, redirect
|
||||
from django.contrib.auth import authenticate, login
|
||||
from django.contrib.auth import authenticate, login, logout
|
||||
from django.contrib.auth.forms import AuthenticationForm
|
||||
|
||||
|
||||
def logout_view(request):
|
||||
logout(request)
|
||||
return redirect('login')
|
||||
|
||||
|
||||
def login_view(request):
|
||||
if request.method == 'POST':
|
||||
form = AuthenticationForm(data=request.POST)
|
||||
@@ -11,7 +17,7 @@ def login_view(request):
|
||||
user = authenticate(username=username, password=password)
|
||||
if user is not None:
|
||||
login(request, user)
|
||||
return redirect('home') # Substitua 'home' pelo nome da sua URL inicial
|
||||
return redirect('home')
|
||||
else:
|
||||
pass
|
||||
# Mensagem de erro: Credenciais inválidas
|
||||
|
||||
Reference in New Issue
Block a user