feat: remove unused images and update email functionality
- Deleted multiple unused image files from the static media directory. - Enhanced email sending functionality by adding a new method `send_hemail` for sending HTML emails. - Updated the `enviar_correo_bienvenida` task to use the new HTML email method. - Added a new RGPD (General Data Protection Regulation) privacy policy page template. - Updated URL routing to include the new RGPD page. - Added a view function for rendering the RGPD page.
@@ -0,0 +1,11 @@
|
|||||||
|
from jinja2 import Environment
|
||||||
|
from django.urls import reverse
|
||||||
|
from django.templatetags.static import static
|
||||||
|
|
||||||
|
def environment(**options):
|
||||||
|
env = Environment(**options)
|
||||||
|
env.globals.update({
|
||||||
|
'static': static,
|
||||||
|
'url': reverse,
|
||||||
|
})
|
||||||
|
return env
|
||||||
@@ -111,6 +111,14 @@ TEMPLATES = [
|
|||||||
],
|
],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
'BACKEND': 'django.template.backends.jinja2.Jinja2',
|
||||||
|
'DIRS': [BASE_DIR / 'templates/jinja2'],
|
||||||
|
'APP_DIRS': True,
|
||||||
|
'OPTIONS': {
|
||||||
|
'environment': 'proyecto.jinja2.environment',
|
||||||
|
},
|
||||||
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
WSGI_APPLICATION = 'proyecto.wsgi.application'
|
WSGI_APPLICATION = 'proyecto.wsgi.application'
|
||||||
|
|||||||
@@ -0,0 +1,21 @@
|
|||||||
|
<table width="100%" border="0" cellspacing="0" cellpadding="0">
|
||||||
|
<tr>
|
||||||
|
<td align="center" style="padding: 20px;">
|
||||||
|
<table width="600" border="0" cellspacing="0" cellpadding="0" style="border: 1px solid #eeeeee; background-color: #ffffff;">
|
||||||
|
<tr>
|
||||||
|
<td align="center" style="background-color: #007bff; padding: 40px;">
|
||||||
|
<h1 style="color: #ffffff; font-family: sans-serif; margin: 0;">¡Hola {{ name }}!</h1>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td style="padding: 30px; font-family: sans-serif; line-height: 1.5; color: #444444;">
|
||||||
|
<p>Has iniciado sesion en <strong>Comercialmeria</strong></p>
|
||||||
|
<p>Si has sido tu, ignore este correo. Si no, <strong>Cambie la contraseña de inmediato</strong>, ¡Alguien se ha colado!</p>
|
||||||
|
<p></p>
|
||||||
|
<p>Este email ha sido enviado automaticamente, no responda a este correo.</p>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
<table width="100%" border="0" cellspacing="0" cellpadding="0">
|
||||||
|
<tr>
|
||||||
|
<td align="center" style="padding: 20px;">
|
||||||
|
<table width="600" border="0" cellspacing="0" cellpadding="0" style="border: 1px solid #eeeeee; background-color: #ffffff;">
|
||||||
|
<tr>
|
||||||
|
<td align="center" style="background-color: #007bff; padding: 40px;">
|
||||||
|
<h1 style="color: #ffffff; font-family: sans-serif; margin: 0;">¡Hola {{ name }}!</h1>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td align="center" style="padding: 40px">
|
||||||
|
<svg fill="#FF0000" width="128px" height="128px" viewBox="-3.2 -3.2 38.40 38.40" version="1.1" xmlns="http://www.w3.org/2000/svg" stroke="#FF0000" stroke-width="0.00032"><g id="SVGRepo_bgCarrier" stroke-width="0" transform="translate(6.4,6.4), scale(0.6)"><rect x="-3.2" y="-3.2" width="38.40" height="38.40" rx="19.2" fill="#1a5fb4" strokewidth="0"></rect></g><g id="SVGRepo_tracerCarrier" stroke-linecap="round" stroke-linejoin="round" stroke="#CCCCCC" stroke-width="1.152"> <title>alert</title> <path d="M14.611 18.856c-0.346 0.352-0.52 0.782-0.52 1.292 0 0.551 0.197 1.014 0.59 1.389 0.363 0.346 0.799 0.519 1.309 0.519 0.521 0 0.971-0.188 1.346-0.566s0.562-0.828 0.562-1.35c0-0.504-0.182-0.943-0.545-1.318-0.363-0.381-0.801-0.571-1.311-0.571-0.567-0.001-1.044 0.201-1.431 0.605v0zM14.391 10.788c-0.299 0.451-0.447 1.011-0.447 1.679 0 0.545 0.092 1.146 0.276 1.802s0.435 1.271 0.751 1.846c0.428 0.779 0.76 1.169 0.994 1.169 0.24 0 0.557-0.305 0.949-0.914 0.346-0.539 0.622-1.152 0.83-1.841s0.312-1.332 0.312-1.93c0-0.902-0.244-1.6-0.73-2.092-0.363-0.375-0.805-0.563-1.326-0.563-0.703 0-1.24 0.282-1.609 0.844v0z"></path> </g><g id="SVGRepo_iconCarrier"> <title>alert</title> <path d="M14.611 18.856c-0.346 0.352-0.52 0.782-0.52 1.292 0 0.551 0.197 1.014 0.59 1.389 0.363 0.346 0.799 0.519 1.309 0.519 0.521 0 0.971-0.188 1.346-0.566s0.562-0.828 0.562-1.35c0-0.504-0.182-0.943-0.545-1.318-0.363-0.381-0.801-0.571-1.311-0.571-0.567-0.001-1.044 0.201-1.431 0.605v0zM14.391 10.788c-0.299 0.451-0.447 1.011-0.447 1.679 0 0.545 0.092 1.146 0.276 1.802s0.435 1.271 0.751 1.846c0.428 0.779 0.76 1.169 0.994 1.169 0.24 0 0.557-0.305 0.949-0.914 0.346-0.539 0.622-1.152 0.83-1.841s0.312-1.332 0.312-1.93c0-0.902-0.244-1.6-0.73-2.092-0.363-0.375-0.805-0.563-1.326-0.563-0.703 0-1.24 0.282-1.609 0.844v0z"></path> </g></svg>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td style="padding: 30px; font-family: sans-serif; line-height: 1.5; color: #444444;">
|
||||||
|
<p>Has iniciado sesion en <strong>Comercialmeria</strong></p>
|
||||||
|
<p>Si has sido tu, ignore este correo. Si no, <strong>Cambie la contraseña de inmediato</strong>, ¡Alguien se ha colado!</p>
|
||||||
|
<p></p>
|
||||||
|
<p>Este email ha sido enviado automaticamente, no responda a este correo.</p>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
Before Width: | Height: | Size: 985 KiB |
|
Before Width: | Height: | Size: 985 KiB |
|
Before Width: | Height: | Size: 985 KiB |
|
Before Width: | Height: | Size: 985 KiB |
|
Before Width: | Height: | Size: 48 KiB |
|
Before Width: | Height: | Size: 48 KiB |
|
Before Width: | Height: | Size: 48 KiB |
|
Before Width: | Height: | Size: 195 KiB |
|
Before Width: | Height: | Size: 195 KiB |
|
Before Width: | Height: | Size: 195 KiB |
|
Before Width: | Height: | Size: 95 KiB |
|
Before Width: | Height: | Size: 95 KiB |
|
Before Width: | Height: | Size: 95 KiB |
|
Before Width: | Height: | Size: 18 KiB |
|
Before Width: | Height: | Size: 18 KiB |
|
Before Width: | Height: | Size: 18 KiB |
|
Before Width: | Height: | Size: 535 KiB |
|
Before Width: | Height: | Size: 535 KiB |
|
Before Width: | Height: | Size: 535 KiB |
|
Before Width: | Height: | Size: 384 KiB |
|
Before Width: | Height: | Size: 384 KiB |
|
Before Width: | Height: | Size: 384 KiB |
|
Before Width: | Height: | Size: 384 KiB |
|
Before Width: | Height: | Size: 163 KiB |
|
Before Width: | Height: | Size: 163 KiB |
|
Before Width: | Height: | Size: 163 KiB |
|
Before Width: | Height: | Size: 163 KiB |
|
Before Width: | Height: | Size: 163 KiB |
|
Before Width: | Height: | Size: 303 KiB |
|
Before Width: | Height: | Size: 303 KiB |
|
Before Width: | Height: | Size: 303 KiB |
|
Before Width: | Height: | Size: 93 KiB |
|
Before Width: | Height: | Size: 93 KiB |
|
Before Width: | Height: | Size: 93 KiB |
|
Before Width: | Height: | Size: 93 KiB |
|
Before Width: | Height: | Size: 411 KiB |
|
Before Width: | Height: | Size: 411 KiB |
|
Before Width: | Height: | Size: 411 KiB |
|
Before Width: | Height: | Size: 11 KiB |
|
Before Width: | Height: | Size: 11 KiB |
|
Before Width: | Height: | Size: 11 KiB |
|
Before Width: | Height: | Size: 13 KiB |
|
Before Width: | Height: | Size: 13 KiB |
|
Before Width: | Height: | Size: 13 KiB |
|
Before Width: | Height: | Size: 222 KiB |
|
Before Width: | Height: | Size: 222 KiB |
|
Before Width: | Height: | Size: 222 KiB |
|
Before Width: | Height: | Size: 49 KiB |
|
Before Width: | Height: | Size: 49 KiB |
|
Before Width: | Height: | Size: 49 KiB |
|
Before Width: | Height: | Size: 60 KiB |
|
Before Width: | Height: | Size: 60 KiB |
|
Before Width: | Height: | Size: 60 KiB |
|
Before Width: | Height: | Size: 300 KiB |
|
Before Width: | Height: | Size: 300 KiB |
|
Before Width: | Height: | Size: 300 KiB |
|
Before Width: | Height: | Size: 18 KiB |
|
Before Width: | Height: | Size: 18 KiB |
|
Before Width: | Height: | Size: 18 KiB |
|
Before Width: | Height: | Size: 320 KiB |
|
Before Width: | Height: | Size: 320 KiB |
|
Before Width: | Height: | Size: 320 KiB |
|
Before Width: | Height: | Size: 120 KiB |
|
Before Width: | Height: | Size: 120 KiB |
|
Before Width: | Height: | Size: 120 KiB |
|
Before Width: | Height: | Size: 111 KiB |
|
Before Width: | Height: | Size: 111 KiB |
|
Before Width: | Height: | Size: 111 KiB |
|
Before Width: | Height: | Size: 111 KiB |
|
Before Width: | Height: | Size: 6.8 KiB |
|
Before Width: | Height: | Size: 6.8 KiB |
|
Before Width: | Height: | Size: 6.8 KiB |
|
Before Width: | Height: | Size: 81 KiB |
|
Before Width: | Height: | Size: 81 KiB |
|
Before Width: | Height: | Size: 81 KiB |
|
Before Width: | Height: | Size: 3.6 KiB |
|
Before Width: | Height: | Size: 3.6 KiB |
|
Before Width: | Height: | Size: 3.6 KiB |
|
Before Width: | Height: | Size: 1.0 KiB |
|
Before Width: | Height: | Size: 1.0 KiB |
|
Before Width: | Height: | Size: 1.0 KiB |
|
Before Width: | Height: | Size: 31 KiB |
|
Before Width: | Height: | Size: 31 KiB |
|
Before Width: | Height: | Size: 31 KiB |
@@ -1,13 +1,21 @@
|
|||||||
from celery import shared_task
|
from celery import shared_task
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from .utilities import send_email
|
from django.template.loader import render_to_string
|
||||||
|
from .utilities import send_email, send_hemail
|
||||||
from .vars import login_message, verify_message
|
from .vars import login_message, verify_message
|
||||||
import random, string
|
import random, string
|
||||||
|
|
||||||
from .models import User, VerificationCode
|
from .models import User, VerificationCode
|
||||||
@shared_task
|
@shared_task
|
||||||
def enviar_correo_bienvenida(email_usuario: str, nombre_usuario: str):
|
def enviar_correo_bienvenida(email_usuario: str, nombre_usuario: str):
|
||||||
send_email(email_usuario, "Inicio de Sesión correcto", login_message.format(name = nombre_usuario))
|
html_content = render_to_string(
|
||||||
|
'emails/welcome.html',
|
||||||
|
{
|
||||||
|
"name": nombre_usuario
|
||||||
|
},
|
||||||
|
using='jinja2'
|
||||||
|
)
|
||||||
|
send_hemail(email_usuario, "Inicio de Sesión correcto", html_content, "Has iniciado sesión...")
|
||||||
|
|
||||||
@shared_task
|
@shared_task
|
||||||
def enviar_correo_confirmacion(usuario: User):
|
def enviar_correo_confirmacion(usuario: User):
|
||||||
|
|||||||
@@ -0,0 +1,64 @@
|
|||||||
|
{% load static %}
|
||||||
|
{% extends "tienda/base.html" %}
|
||||||
|
{% block content %}
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-12">
|
||||||
|
<article class="legal-container">
|
||||||
|
<h1>Política de Privacidad (RGPD)</h1>
|
||||||
|
<p>La presente Política de Privacidad establece los términos en que <strong>{{ nombre_tienda|default:"[Nombre de tu Tienda]" }}</strong> usa y protege la información proporcionada por sus usuarios en el marco de nuestro e-commerce local en Almería.</p>
|
||||||
|
|
||||||
|
<section class="legal-section">
|
||||||
|
<h2>1. Responsable del Tratamiento</h2>
|
||||||
|
<p>Los datos recabados a través de esta web son responsabilidad de:</p>
|
||||||
|
<address>
|
||||||
|
<strong>Identidad:</strong> Comercialmeria<br>
|
||||||
|
<strong>NIF/CIF:</strong> [00000000X]<br>
|
||||||
|
<strong>Dirección:</strong> (Dirección de la empresa)<br>
|
||||||
|
<strong>Email:</strong> <a href="mailto:info@tuweb.com">example@example.com</a>
|
||||||
|
</address>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<section class="legal-section">
|
||||||
|
<h2>2. Información que Recopilamos</h2>
|
||||||
|
<p>Para procesar pedidos y consultas en Almería y provincia, solicitamos:</p>
|
||||||
|
<ul>
|
||||||
|
<li><strong>Datos identificativos:</strong> Nombre, apellidos y DNI (para facturación).</li>
|
||||||
|
<li><strong>Contacto:</strong> Email y teléfono.</li>
|
||||||
|
<li><strong>Logística:</strong> Dirección de envío en Almería o resto de España.</li>
|
||||||
|
</ul>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<section class="legal-section">
|
||||||
|
<h2>3. Finalidad y Legitimación</h2>
|
||||||
|
<p>Tratamos sus datos para:</p>
|
||||||
|
<ul>
|
||||||
|
<li><strong>Gestión contractual:</strong> Tramitar compras y envíos (Base: Ejecución de contrato).</li>
|
||||||
|
<li><strong>Atención al cliente:</strong> Responder dudas vía formulario (Base: Interés legítimo).</li>
|
||||||
|
<li><strong>Newsletter:</strong> Información sobre productos locales (Base: Consentimiento explícito).</li>
|
||||||
|
</ul>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<section class="legal-section">
|
||||||
|
<h2>4. Conservación y Destinatarios</h2>
|
||||||
|
<p>Los datos se conservarán mientras dure la relación comercial y durante los plazos legales (generalmente 6 años por normativa contable). Solo se comunicarán datos a:</p>
|
||||||
|
<ul>
|
||||||
|
<li>Agencias de transporte para la entrega del producto.</li>
|
||||||
|
<li>Administración Tributaria para el cumplimiento de obligaciones fiscales.</li>
|
||||||
|
<li>Entidades bancarias para el cobro de los pedidos.</li>
|
||||||
|
</ul>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<section class="legal-section">
|
||||||
|
<h2>5. Sus Derechos</h2>
|
||||||
|
<p>Como usuario, puede ejercer sus derechos de acceso, rectificación, supresión, limitación y oposición enviando un correo a <strong>[correo@tuweb.com]</strong>, adjuntando prueba de identidad.</p>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<footer class="legal-footer">
|
||||||
|
<p><small>Última actualización: Marzo 2026. Documentación para Proyecto Final DAW.</small></p>
|
||||||
|
</footer>
|
||||||
|
</article>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{% endblock %}
|
||||||
@@ -44,5 +44,6 @@ urlpatterns = [
|
|||||||
path("usuario/direcciones/<int:id>/editar/", views.editar_direccion, name="editar_direccion"),
|
path("usuario/direcciones/<int:id>/editar/", views.editar_direccion, name="editar_direccion"),
|
||||||
path("usuario/direcciones/<int:id>/eliminar/", views.eliminar_direccion, name="eliminar_direccion"),
|
path("usuario/direcciones/<int:id>/eliminar/", views.eliminar_direccion, name="eliminar_direccion"),
|
||||||
path("usuario/mensajes/", views.mensajes_comprador, name="mensajes_comprador"),
|
path("usuario/mensajes/", views.mensajes_comprador, name="mensajes_comprador"),
|
||||||
path("verify/<str:code>", views.verify, name="verify")
|
path("verify/<str:code>", views.verify, name="verify"),
|
||||||
|
path("rgpd", views.rgpd, name="rgpd")
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -39,6 +39,23 @@ def send_email(dest: str, title: str, body: str):
|
|||||||
fail_silently=False,
|
fail_silently=False,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
logger.info("EMAIL_SENT to=%s subject=%s", dest, title)
|
||||||
|
return (True,)
|
||||||
|
except Exception as e:
|
||||||
|
logger.exception("EMAIL_SEND_FAILED to=%s subject=%s error=%s", dest, title, str(e))
|
||||||
|
return (False, e)
|
||||||
|
|
||||||
|
def send_hemail(dest: str, title: str, body: str, nbody: str):
|
||||||
|
try:
|
||||||
|
send_mail(
|
||||||
|
subject=title,
|
||||||
|
html_message=body,
|
||||||
|
from_email=settings.DEFAULT_FROM_EMAIL,
|
||||||
|
recipient_list=[dest],
|
||||||
|
fail_silently=False,
|
||||||
|
message=nbody
|
||||||
|
)
|
||||||
|
|
||||||
logger.info("EMAIL_SENT to=%s subject=%s", dest, title)
|
logger.info("EMAIL_SENT to=%s subject=%s", dest, title)
|
||||||
return (True,)
|
return (True,)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
|||||||
@@ -1253,4 +1253,7 @@ def reset_password(request: HttpRequest):
|
|||||||
return redirect("index")
|
return redirect("index")
|
||||||
|
|
||||||
|
|
||||||
return render(request, "tienda/reset_password", {})
|
return render(request, "tienda/reset_password", {})
|
||||||
|
|
||||||
|
def rgpd(request: HttpRequest):
|
||||||
|
return render(request, "tienda/rgpd.html", {})
|
||||||