diff --git a/JugarAlPadel/K8S/Makefile.local b/JugarAlPadel/K8S/Makefile.local index fdb4761..8308717 100644 --- a/JugarAlPadel/K8S/Makefile.local +++ b/JugarAlPadel/K8S/Makefile.local @@ -2,7 +2,7 @@ export ARQUITECTURA := $(shell lscpu |grep itectur | tr -d ' '| cut -f2 -d':') export REGISTRY=localhost:30500 #export REGISTRY=registry.reymota.es -export IMG_VERSION = 0.32 +export IMG_VERSION = 0.38 export IMG_NGINX_VERSION = 2.4 # limpia todo diff --git a/JugarAlPadel/gestion_reservas/accounts/urls.py b/JugarAlPadel/gestion_reservas/accounts/urls.py index 40d77bd..18542fc 100644 --- a/JugarAlPadel/gestion_reservas/accounts/urls.py +++ b/JugarAlPadel/gestion_reservas/accounts/urls.py @@ -7,4 +7,8 @@ urlpatterns = [ path('login/', auth_views.LoginView.as_view(), name='login'), path('logout/', auth_views.LogoutView.as_view(), name='logout'), path("signup/", SignUpView.as_view(), name="signup"), + path('password_reset/', auth_views.PasswordResetView.as_view(), name='password_reset'), + path('password_reset/done/', auth_views.PasswordResetDoneView.as_view(), name='password_reset_done'), + path('reset///', auth_views.PasswordResetConfirmView.as_view(), name='password_reset_confirm'), + path('reset/done/', auth_views.PasswordResetCompleteView.as_view(), name='password_reset_complete'), ] diff --git a/JugarAlPadel/gestion_reservas/eventos/models.py b/JugarAlPadel/gestion_reservas/eventos/models.py index a51d91f..ab45278 100644 --- a/JugarAlPadel/gestion_reservas/eventos/models.py +++ b/JugarAlPadel/gestion_reservas/eventos/models.py @@ -6,7 +6,7 @@ from django.utils import timezone class Evento(models.Model): nombre = models.CharField(max_length=100) descripcion = models.TextField() - fecha = models.DateTimeField() + fecha = models.DateField() hora = models.TimeField(default=timezone.now) # Nuevo campo para la hora plazas_disponibles = models.PositiveIntegerField() @@ -26,7 +26,7 @@ class Reserva(models.Model): fecha_reserva = models.DateTimeField(auto_now_add=True) def __str__(self): - return f'{self.usuario.nombre} - {self.evento.nombre}' + return f'{self.usuario.nombre} - {self.evento.nombre} reserva realizada a las {self.fecha_reserva}' class ListaEspera(models.Model): diff --git a/JugarAlPadel/gestion_reservas/eventos/views.py b/JugarAlPadel/gestion_reservas/eventos/views.py index c36b53a..dee6ed7 100644 --- a/JugarAlPadel/gestion_reservas/eventos/views.py +++ b/JugarAlPadel/gestion_reservas/eventos/views.py @@ -33,7 +33,7 @@ def reservar_evento(request, evento_id): f'Detalles del evento:\n' \ f'Nombre: {evento.nombre}\n' \ f'Descripción: {evento.descripcion}\n' \ - f'Fecha: {evento.fecha.strftime("%d/%b/%y")} a las {evento.hora.hour}\n' \ + f'Fecha: {evento.fecha.strftime("%d/%b/%y")} a las {evento.hora}\n' \ f'\n¡Gracias por inscribirte!\n\n' html_content = render_to_string('emails/confirmacion_reserva.html', {'evento': evento, 'usuario': request.user}) diff --git a/JugarAlPadel/gestion_reservas/gestion_reservas/settings.py b/JugarAlPadel/gestion_reservas/gestion_reservas/settings.py index 3ac45f3..09a66bd 100644 --- a/JugarAlPadel/gestion_reservas/gestion_reservas/settings.py +++ b/JugarAlPadel/gestion_reservas/gestion_reservas/settings.py @@ -168,3 +168,6 @@ DEFAULT_FROM_EMAIL = 'jugaralpadelentreamigos@gmail.com' # Dirección del administrador ADMIN_EMAIL = 'king.bernard.b@gmail.com' + +# El tiempo de validez del enlace para resetear la contraseña (por defecto es de 3 días) +PASSWORD_RESET_TIMEOUT = 86400 # 1 día en segundos diff --git a/JugarAlPadel/gestion_reservas/templates/emails/confirmacion_reserva.html b/JugarAlPadel/gestion_reservas/templates/emails/confirmacion_reserva.html index da31a5f..40daaa4 100644 --- a/JugarAlPadel/gestion_reservas/templates/emails/confirmacion_reserva.html +++ b/JugarAlPadel/gestion_reservas/templates/emails/confirmacion_reserva.html @@ -2,5 +2,5 @@

Hola {{ usuario.nombre }},

Te has inscrito correctamente en el evento {{ evento.nombre }}.

Descripción: {{ evento.descripcion }}

-

Fecha: {{ evento.fecha }}

+

Fecha: {{ evento.fecha }} a las {{ evento.hora}}

¡Gracias por inscribirte!

diff --git a/JugarAlPadel/gestion_reservas/templates/registration/login.html b/JugarAlPadel/gestion_reservas/templates/registration/login.html index 01d9f8f..8d93fc7 100644 --- a/JugarAlPadel/gestion_reservas/templates/registration/login.html +++ b/JugarAlPadel/gestion_reservas/templates/registration/login.html @@ -50,12 +50,10 @@ {{ form.password }} - {% url 'admin_password_reset' as password_reset_url %} - {% if password_reset_url %} + - {% endif %}
diff --git a/JugarAlPadel/gestion_reservas/templates/registration/password_reset_complete.html b/JugarAlPadel/gestion_reservas/templates/registration/password_reset_complete.html new file mode 100644 index 0000000..1ba0aae --- /dev/null +++ b/JugarAlPadel/gestion_reservas/templates/registration/password_reset_complete.html @@ -0,0 +1,7 @@ +{% extends 'base.html' %} + +{% block content %} +

Contraseña restablecida

+

Tu contraseña ha sido restablecida exitosamente. Ahora puedes iniciar sesión con tu nueva contraseña.

+ Iniciar sesión +{% endblock %} diff --git a/JugarAlPadel/gestion_reservas/templates/registration/password_reset_confirm.html b/JugarAlPadel/gestion_reservas/templates/registration/password_reset_confirm.html new file mode 100644 index 0000000..8f0b848 --- /dev/null +++ b/JugarAlPadel/gestion_reservas/templates/registration/password_reset_confirm.html @@ -0,0 +1,11 @@ +{% extends 'base.html' %} + +{% block content %} +

Introduce una nueva contraseña

+ +
+ {% csrf_token %} + {{ form.as_p }} + +
+{% endblock %} diff --git a/JugarAlPadel/gestion_reservas/templates/registration/password_reset_done.html b/JugarAlPadel/gestion_reservas/templates/registration/password_reset_done.html new file mode 100644 index 0000000..300019d --- /dev/null +++ b/JugarAlPadel/gestion_reservas/templates/registration/password_reset_done.html @@ -0,0 +1,7 @@ +{% extends 'base.html' %} + +{% block content %} +

Correo enviado

+

Se ha enviado un correo con instrucciones para restablecer tu contraseña si la dirección de correo proporcionada es correcta.

+ Volver a iniciar sesión +{% endblock %} diff --git a/JugarAlPadel/gestion_reservas/templates/registration/password_reset_form.html b/JugarAlPadel/gestion_reservas/templates/registration/password_reset_form.html new file mode 100644 index 0000000..b14f34e --- /dev/null +++ b/JugarAlPadel/gestion_reservas/templates/registration/password_reset_form.html @@ -0,0 +1,12 @@ +{% extends 'base.html' %} + +{% block content %} +

Solicitar restablecimiento de contraseña

+

Introduce tu dirección de correo electrónico, y te enviaremos un enlace para restablecer tu contraseña.

+ +
+ {% csrf_token %} + {{ form.as_p }} + +
+{% endblock %}