Compare commits
4 Commits
cda9adb986
...
e8a5091dfd
| Author | SHA1 | Date | |
|---|---|---|---|
| e8a5091dfd | |||
| a0ee6ecd14 | |||
| d6c9aa3db3 | |||
| 9751d19401 |
@@ -0,0 +1,27 @@
|
||||
<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;">Su cuenta ha sido desbloqueada</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>Hemos aceptado la apelación del previo baneo de su cuenta</p>
|
||||
<p>Su cuenta ha sido desbloqueada y ya puede entrar, pero los productos seguirán eliminados, por lo que deberá recrearlos para seguir vendiendolos</p>
|
||||
<p>Muchas gracias por su paciencia</p>
|
||||
<p></p>
|
||||
<p style="color: gray;">Este email ha sido enviado automaticamente, no responda a este correo.</p>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
+31
-1
@@ -20,20 +20,50 @@ class UserAdmin(admin.ModelAdmin):
|
||||
def banear_usuario_action(self, request, queryset):
|
||||
usuarios_baneados = 0
|
||||
for user in queryset:
|
||||
user: User = user
|
||||
# Desactiva usuario
|
||||
if user.registration_status == User.RegisterStatus.BANNED:
|
||||
continue
|
||||
|
||||
user.is_active = False
|
||||
user.registration_status = User.RegisterStatus.BANNED
|
||||
user.save()
|
||||
|
||||
# Enviar task a Worker
|
||||
tasks.banear_usuario.delay(user.email)
|
||||
|
||||
# Borrar productos
|
||||
Product.objects.filter(creator=user).delete()
|
||||
usuarios_baneados+=1
|
||||
self.message_user(
|
||||
request,
|
||||
f"Se ha(n) baneado {usuarios_baneados} usuario(s) correctamente.",
|
||||
level=messages.SUCCESS
|
||||
)
|
||||
def desbanear_usuario_action(self, request, queryset):
|
||||
user_desbaneados = 0
|
||||
for user in queryset:
|
||||
user: User = user
|
||||
if user.registration_status != User.RegisterStatus.BANNED:
|
||||
continue
|
||||
|
||||
user.is_active = True
|
||||
user.registration_status = User.RegisterStatus.ACTIVE
|
||||
user.save()
|
||||
|
||||
tasks.desbanear_usuario.delay(user.email)
|
||||
|
||||
user_desbaneados -= 1
|
||||
self.message_user(
|
||||
request,
|
||||
f"Se ha(n) desbaneado {user_desbaneados} usuario(s)",
|
||||
level=messages.SUCCESS
|
||||
)
|
||||
|
||||
|
||||
|
||||
banear_usuario_action.short_description = "Banear usuarios seleccionados"
|
||||
|
||||
desbanear_usuario_action.short_description = "Desbanear usuarios seleccionados"
|
||||
|
||||
@admin.register(Product)
|
||||
class ProductAdmin(admin.ModelAdmin):
|
||||
|
||||
@@ -29,6 +29,17 @@ def banear_usuario(email_usuario: str):
|
||||
)
|
||||
|
||||
send_hemail(email_usuario, "Cuenta Bloqueada", html_content, "Tu cuenta ha sido bloqueada...")
|
||||
|
||||
@shared_task
|
||||
def desbanear_usuario(email_usuario: str):
|
||||
html_content = render_to_string(
|
||||
'emails/unban.html',
|
||||
{},
|
||||
using='jinja2'
|
||||
)
|
||||
|
||||
send_hemail(email_usuario, "Cuenta Desbloqueada", html_content, "Tu cuenta ha sido desbloqueada...")
|
||||
|
||||
@shared_task
|
||||
def enviar_correo_confirmacion(id: int):
|
||||
usuario = User.objects.get(id=id)
|
||||
|
||||
Reference in New Issue
Block a user