Fixed emails

This commit is contained in:
Diego Calvo
2021-03-30 14:19:16 +02:00
parent 98b0099e45
commit 373e892463
5 changed files with 74 additions and 39 deletions

View File

@@ -52,6 +52,15 @@ SIMPLE_JWT = {
EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
# For testing emails
# https://medium.com/@_christopher/how-to-send-emails-with-python-django-through-google-smtp-server-for-free-22ea6ea0fb8e
# EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
# EMAIL_HOST = 'smtp.gmail.com'
# EMAIL_USE_TLS = True
# EMAIL_PORT = 587
# EMAIL_HOST_USER = '' # your email account
# EMAIL_HOST_PASSWORD = '' #your password
# disable web interface for REST backend
# REST_FRAMEWORK['DEFAULT_RENDERER_CLASSES'] = ('rest_framework.renderers.JSONRenderer',)

View File

@@ -71,12 +71,13 @@ def create_admin_user(email, password):
def send_verification_email(request, user):
try:
current_site = get_current_site(request)
uid = urlsafe_base64_encode(force_bytes(user.pk))
token = account_activation_token.make_token(user)
verification_url = 'https://' + current_site.domain + '/activate/' + uid + '/' + token
subject = 'Activa Tu Cuenta'
message = render_to_string('email_verification.html', {
'user': user,
'domain': current_site.domain,
'uid': urlsafe_base64_encode(force_bytes(user.pk)),
'token': account_activation_token.make_token(user),
'verification_url': verification_url
})
email = EmailMessage(
subject, message, to=[user.email]

View File

@@ -209,7 +209,7 @@
height="auto"
width="25"
align="left"
src="https://latienda.coop/_nuxt/img/latienda-logo.3e53761.svg"
src="https://latienda.coop/_nuxt/img/latienda-logo.dea6549.png"
style="
border: none;
display: block;
@@ -485,12 +485,12 @@
"
>
Hola {{ user.full_name }},
<br />
<br /><br />
Por favor, verifica tu
registro en LaTiendaCOOP
haciendo click <a href="https://{{ domain }}{% url
'activate_user' uidb64=uid
token=token %}">AQUÍ</a>
haciendo click en el siguiente enlace:
<br/> <br />
<a href="{{verification_url}}">{{verification_url}}</a>
<br />
</p>

View File

@@ -430,21 +430,11 @@
href="https://latienda.coop/productos/{{product.id}}"
target="_blank"
>
{% if product.image %}
<img
alt=""
height="auto"
{%
if
product.image
%}
src="{{product.image.url}}"
{%
else
%}
src="https://latienda.coop/_nuxt/img/latienda-product-default.0b2c2e0.svg"
{%
endif
%}
style="
border: none;
display: block;
@@ -456,6 +446,23 @@
"
width="250"
/>
{% else %}
<img
alt=""
height="auto"
src="https://latienda.coop/_nuxt/img/latienda-product-default.772863e.png"
style="
border: none;
display: block;
outline: none;
text-decoration: none;
height: auto;
width: 100%;
font-size: 13px;
"
width="250"
/>
{% endif %}
</a>
</td>
</tr>
@@ -729,18 +736,28 @@
<tr>
<td>
<a href="{{company.shop_link}}" target="_blank">
{% if company.logo %}
<img
alt="logo cooperativa"
height="auto"
{%
if
company.logo
%}
src="{{company.logo.url}}"
{%
else
%}
src="https://latienda.coop/_nuxt/img/latienda-product-default.0b2c2e0.svg"
style="
border: none;
display: block;
outline: none;
text-decoration: none;
height: auto;
width: 50%;
font-size: 13px;
padding-top: 20px;
margin: auto;
"
/>
{% else %}
<img
alt="logo cooperativa"
height="auto"
src="https://latienda.coop/_nuxt/img/latienda-product-default.772863e.png"
{%
endif
%}
@@ -756,6 +773,7 @@
margin: auto;
"
/>
{% endif %}
</a>
</td>
</tr>

View File

@@ -426,21 +426,11 @@
href="https://latienda.coop/productos/{{product.id}}"
target="_blank"
>
{% if product.image %}
<img
alt=""
height="auto"
{%
if
product.image
%}
src="{{product.image.url}}"
{%
else
%}
src="https://latienda.coop/_nuxt/img/latienda-product-default.0b2c2e0.svg"
{%
endif
%}
style="
border: none;
display: block;
@@ -452,6 +442,23 @@
"
width="250"
/>
{% else %}
<img
alt=""
height="auto"
src="https://latienda.coop/_nuxt/img/latienda-product-default.772863e.png"
style="
border: none;
display: block;
outline: none;
text-decoration: none;
height: auto;
width: 100%;
font-size: 13px;
"
width="250"
/>
{% endif %}
</a>
</td>
</tr>
@@ -941,7 +948,7 @@
>
<div
style="
font-family: Poppins;
font-family: Poppins, Arial, sans-serif;
font-size: 15px;
line-height: 1;
text-align: center;