Fix #10 #15 login/logout con redireccionamiento habilitado

This commit is contained in:
perro tuerto 2023-03-16 12:15:31 -07:00
parent 2344bc5fe3
commit 71325272b8
6 changed files with 49 additions and 1 deletions

View File

@ -320,6 +320,18 @@ section#notice a {
height: 2.9rem;
}
/* LOGIN / LOGOUT */
#login-form {
width: 16rem;
margin: auto;
text-align: center;
}
#login-form > * {
margin-top: .5rem;
}
/* ICONS; cfr: https://css.gg */
.gg-time {

View File

@ -44,3 +44,7 @@ def movie(request, id):
def api(request):
context = Movie.objects.api(request)
return JsonResponse(context)
def error_404(request, exception):
return render(request, "404.html")

View File

@ -17,4 +17,7 @@ urlpatterns = [
path("movie/<int:id>", views.movie, name="movie"),
path("ultimas/rss/", LatestMoviesFeed()),
path("admin/", admin.site.urls),
path("user/", include("django.contrib.auth.urls")),
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
handler404 = views.error_404

11
source/templates/404.html Normal file
View File

@ -0,0 +1,11 @@
{% extends "base.html" %}
{% block content %}
<section class="hero">
<div class="hero-body">
<p class="title"> ¡Ups! Página no encontrada.</p>
</div>
</section>
{% endblock %}

View File

@ -23,7 +23,11 @@
<a class="navbar-item" href="{% url 'about' %}" >Acerca</a>
<a class="navbar-item" href="{% url 'help' %}" >Ayuda</a>
<hr class="navbar-divider">
<a class="navbar-item" href="{% url 'admin:index' %}">Ingresa</a>
{% if user.is_authenticated %}
<a class="navbar-item" href="{% url 'logout' %}?next={{ request.path }}">Salir</a>
{% else %}
<a class="navbar-item" href="{% url 'login' %}?next={{ request.path }}">Ingresa</a>
{% endif %}
<!--
<a class="navbar-item" href="{% url 'bugs' %}">Reporta un problema</a>
-->

View File

@ -0,0 +1,14 @@
{% extends "base.html" %}
{% block content %}
<div class="hero full">
<div class="hero-body">
<form id="login-form" method="post">
{% csrf_token %}
<input class="input is-primary" placeholder="Usuario" type="text" name="username" autofocus="" autocapitalize="none" autocomplete="username" maxlength="150" required="" id="id_username">
<input class="input is-primary" placeholder="Contraseña" type="password" name="password" autocomplete="current-password" required="" id="id_password">
<button class="button is-primary" type="submit">Ingresa</button>
</form>
</div>
</div>
{% endblock %}