Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/171-fix-email #177

Merged
merged 6 commits into from
Apr 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion nexong/api/Authentication/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ def get(self, request, *args, **kwargs):
user.is_enabled = True
user.is_active = True
user.save()
return redirect(reverse("activation_success"))
return redirect("http://127.0.0.1:3000/iniciar-sesion/")
else:
return Response(
{"detail": "Token not valid"},
Expand Down
5 changes: 5 additions & 0 deletions nexong/email.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
from djoser import email


class ActivationEmail(email.ActivationEmail):
template_name = "account/activation.html"
15 changes: 15 additions & 0 deletions nexong/templates/account/activation.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{% load i18n %}

{% block subject %}
{% blocktrans %}Activación de cuenta en {{ site_name }}{% endblocktrans %}
{% endblock subject %}


{% block html_body %}
<p>{% blocktrans %}
Estás recibiendo este correo porque necesitas finalizar el proceso de activación de tu cuenta en {{ protocol }}://{{ domain }}/{{ url|safe }}
{% endblocktrans %}</p>
<p>Al pulsar el botón, se activará su cuenta y será redirigido a la página de inicio de sesión: </p>
<p style="margin-bottom:100px"><a style="display: inline-block; padding: 10px 20px; background-color: #add8e6; color: #333333; text-decoration: none;" href="{{ protocol }}://{{ domain }}/{{ url|safe }}">Activar cuenta</a></p>

{% endblock html_body %}
3 changes: 3 additions & 0 deletions src/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,9 @@
},
"SOCIAL_AUTH_TOKEN_STRATEGY": "djoser.social.token.jwt.TokenStrategy",
"SOCIAL_AUTH_ALLOWED_REDIRECT_URIS": white_list,
"EMAIL": {
"activation": "nexong.email.ActivationEmail",
},
}

SOCIAL_AUTH_GOOGLE_OAUTH2_KEY = config("GOOGLE_OAUTH2_KEY")
Expand Down