Browse Source

Cambios en urls de accounts

politica
Celestino Rey 1 year ago
parent
commit
545df9a228
4 changed files with 83 additions and 40 deletions
  1. +3
    -0
      Libros/biblioteca/accounts/urls.py
  2. +1
    -3
      Libros/biblioteca/biblioteca/urls.py
  3. +77
    -36
      Libros/biblioteca/gestion/templates/registration/login.html
  4. +2
    -1
      Libros/biblioteca/gestion/templates/registration/signup.html

+ 3
- 0
Libros/biblioteca/accounts/urls.py View File

@ -1,9 +1,12 @@
# accounts/urls.py
from django.urls import path
from django.contrib.auth import views as auth_views
from .views import SignUpView
urlpatterns = [
path("signup/", SignUpView.as_view(), name="signup"),
path('login/', auth_views.LoginView.as_view(), name='login'),
path('logout/', auth_views.LogoutView.as_view(), name='logout'),
]

+ 1
- 3
Libros/biblioteca/biblioteca/urls.py View File

@ -18,7 +18,6 @@ from django.contrib import admin
from django.urls import path, include
from django.conf import settings
from django.conf.urls.static import static
from django.contrib.auth import views as auth_views
from django.views.generic.base import TemplateView # new
urlpatterns = [
@ -26,8 +25,7 @@ urlpatterns = [
path('gestion/', include('gestion.urls')),
path("accounts/", include("accounts.urls")), # new
path('accounts/login/', auth_views.LoginView.as_view(), name='login'),
path('accounts/logout/', auth_views.LogoutView.as_view(), name='logout'),
path("accounts/", include("django.contrib.auth.urls")),
path("", TemplateView.as_view(template_name="gestion/index.html"), name="principal"), # new


+ 77
- 36
Libros/biblioteca/gestion/templates/registration/login.html View File

@ -1,3 +1,5 @@
{% load i18n static %}
{% include "_head.html" %}
<body class="app app-login p-0">
@ -7,43 +9,82 @@
<div class="app-auth-body mx-auto">
{% include "_branding.html" %}
<h2 class="auth-heading text-center mb-5">Entrar en Lyrics</h2>
<div class="auth-form-container text-start">
<form class="auth-form login-form" method="POST">
{% csrf_token %}
{{ form.as_p }}
{% if form.errors and not form.non_field_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 %}
{% if form.non_field_errors %}
{% for error in form.non_field_errors %}
<p class="errornote">
{{ error }}
</p>
{% endfor %}
{% endif %}
<div class="auth-form-container text-start" id="content-main">
{% if user.is_authenticated %}
<p class="errornote">
{% blocktranslate trimmed %}
You are authenticated as {{ username }}, but are not authorized to
access this page. Would you like to login to a different account?
{% endblocktranslate %}
</p>
{% endif %}
<form class="auth-form login-form" action="{{ app_path }}" method="post" id="login-form">{% csrf_token %}
<div class="text mb-3">
{{ form.username.errors }}
{{ form.username.label_tag }}
</div>
<div class="text mb-3">
{{ form.username }}
</div>
<div class="password mb-3">
{{ form.password.errors }}
{{ form.password.label_tag }}
</div>
<div class="password mb-3">
{{ form.password }}
<input type="hidden" name="next" value="{{ next }}">
</div>
{% url 'admin_password_reset' as password_reset_url %}
{% if password_reset_url %}
<div class="password-reset-link">
<a href="{{ password_reset_url }}">{% translate 'Forgotten your password or username?' %}</a>
</div>
{% endif %}
<div class="text-center">
<button type="submit" class="btn app-btn-primary w-100 theme-btn mx-auto">Log In</button>
</div>
</form>
<div class="auth-option text-center pt-5">¿No tienes cuenta? Registrate <a class="text-link" href="#" >aquí</a>.</div>
</div><!--//auth-form-container-->
</div><!--//auth-body-->
{% include "_footer.html" %}
</div><!--//flex-column-->
</div><!--//auth-main-col-->
<div class="col-12 col-md-5 col-lg-6 h-100 auth-background-col">
<div class="auth-background-holder">
</div>
<div class="auth-background-mask"></div>
<div class="auth-background-overlay p-3 p-lg-5">
<div class="d-flex flex-column align-content-end h-100">
<div class="h-100"></div>
<!--
<div class="overlay-content p-3 p-lg-4 rounded">
<h5 class="mb-3 overlay-title">Explore Portal Admin Template</h5>
<div>Portal is a free Bootstrap 5 admin dashboard template. You can download and view the template license <a href="https://themes.3rdwavemedia.com/bootstrap-templates/admin-dashboard/portal-free-bootstrap-admin-dashboard-template-for-developers/">here</a>.</div>
</div>
-->
</div>
</div><!--//auth-background-overlay-->
</div><!--//auth-background-col-->
</div><!--//row-->
<input type="submit" class="btn app-btn-primary w-100 theme-btn mx-auto" value="{% translate 'Log in' %}">
</div>
</form>
<div class="auth-option text-center pt-5">¿No tienes cuenta? Registrate <a class="text-link" href="{% url 'signup' %}" >aquí</a>.</div>
</div>
</div>
{% include "_footer.html" %}
</div>
</div>
<div class="col-12 col-md-5 col-lg-6 h-100 auth-background-col">
<div class="auth-background-holder">
</div>
<div class="auth-background-mask"></div>
<div class="auth-background-overlay p-3 p-lg-5">
<div class="d-flex flex-column align-content-end h-100">
<div class="h-100"></div>
<!--
<div class="overlay-content p-3 p-lg-4 rounded">
<h5 class="mb-3 overlay-title">Explore Portal Admin Template</h5>
<div>Portal is a free Bootstrap 5 admin dashboard template. You can download and view the template license <a href="https://themes.3rdwavemedia.com/bootstrap-templates/admin-dashboard/portal-free-bootstrap-admin-dashboard-template-for-developers/">here</a>.</div>
</div>
-->
</div>
</div><!--//auth-background-overlay-->
</div><!--//auth-background-col-->
</div><!--//row-->
</body>
</html>
</html>

+ 2
- 1
Libros/biblioteca/gestion/templates/registration/signup.html View File

@ -14,7 +14,8 @@
<form class="auth-form auth-signup-form" method="POST" enctype="multipart/form-data">
{% csrf_token %}
{{ form }}
<div class="text-center">
<div class="item border-bottom py-3"></div>
<div class="text-center">
<button type="submit" class="btn app-btn-primary w-100 theme-btn mx-auto">Sign Up</button>
</div>
</form><!--//auth-form-->


Loading…
Cancel
Save