-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
improves registration email, makes custom registration view
- Loading branch information
1 parent
8bee8aa
commit 9b2ed0e
Showing
7 changed files
with
131 additions
and
74 deletions.
There are no files selected for viewing
64 changes: 64 additions & 0 deletions
64
feed/templates/django_registration/activation_email_body.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
{% extends 'emails/base.html' %} | ||
{% block content %} | ||
<div style="font-weight:normal;padding:0px 24px 16px 24px"> | ||
<p>Hi👋 I'm Mikhail, creator of thewalter.app.</p> | ||
</div> | ||
<div style="font-weight:normal;padding:16px 24px 16px 24px"> | ||
I hope this message finds you well! First and foremost, I want | ||
to extend my heartfelt thanks for your patience and enthusiasm. | ||
It means the world to me that you’re excited to be a part of | ||
thewalter.app. | ||
</div> | ||
<div style="font-weight:normal;padding:16px 24px 16px 24px"> | ||
There only one thing left for you to is your account activation. | ||
</div> | ||
<div style="font-weight:normal;padding:16px 24px 16px 24px"> | ||
To activate our account, simply click the link below and follow the | ||
instructions: | ||
</div> | ||
<div style="padding:16px 24px 24px 24px"> | ||
<a | ||
href="{{ protocol }}://{{ site }}{% url 'django_registration_activate' %}?activation_key={{activation_key}}" | ||
style="color:#FFFFFF;font-size:16px;font-weight:500;background-color:#FF6340;border-radius:16px;display:inline-block;padding:8px 16px;text-decoration:none" | ||
target="_blank" | ||
><span | ||
><!--[if mso | ||
]><i | ||
style="letter-spacing: 20px;mso-font-width:-100%;mso-text-raise:30" | ||
hidden | ||
> </i | ||
><! | ||
[endif]--></span | ||
><span>Activate an account</span | ||
><span | ||
><!--[if mso | ||
]><i | ||
style="letter-spacing: 20px;mso-font-width:-100%" | ||
hidden | ||
> </i | ||
><! | ||
[endif]--></span | ||
></a | ||
> | ||
</div> | ||
<div style="font-weight:normal;padding:16px 24px 16px 24px"> | ||
<p> | ||
If you have any questions or need assistance, don't | ||
hesitate to reach out to me directly via | ||
<a href="https://t.me/mrmike24" target="_blank">Telegram</a> | ||
or | ||
<a href="https://x.com/mrmegatelo" target="_blank">Twitter</a | ||
>. Your feedback is invaluable as the service continues to | ||
improve. I genuinely look forward to hearing about your | ||
experiences and how thewalter.app is making a difference for | ||
you. | ||
</p> | ||
</div> | ||
<div style="font-weight:normal;padding:16px 24px 16px 24px"> | ||
Thank you once again for joining us on this journey. Welcome to | ||
the Walter community – we’re so happy to have you here! | ||
</div> | ||
<div style="font-weight:normal;padding:16px 24px 16px 24px"> | ||
Warm regards, Mikhail | ||
</div> | ||
{% endblock %} |
85 changes: 21 additions & 64 deletions
85
feed/templates/django_registration/activation_email_body.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,64 +1,21 @@ | ||
{% extends 'emails/base.html' %} | ||
{% block content %} | ||
<div style="font-weight:normal;padding:0px 24px 16px 24px"> | ||
<p>Hi👋 I'm Mikhail, creator of thewalter.app.</p> | ||
</div> | ||
<div style="font-weight:normal;padding:16px 24px 16px 24px"> | ||
I hope this message finds you well! First and foremost, I want | ||
to extend my heartfelt thanks for your patience and enthusiasm. | ||
It means the world to me that you’re excited to be a part of | ||
thewalter.app. | ||
</div> | ||
<div style="font-weight:normal;padding:16px 24px 16px 24px"> | ||
There only one thing left for you to is your account activation. | ||
</div> | ||
<div style="font-weight:normal;padding:16px 24px 16px 24px"> | ||
To activate our account, simply click the link below and follow the | ||
instructions: | ||
</div> | ||
<div style="padding:16px 24px 24px 24px"> | ||
<a | ||
href="{{ protocol }}://{{ site }}{% url 'django_registration_activate' %}?activation_key={{activation_key}}" | ||
style="color:#FFFFFF;font-size:16px;font-weight:500;background-color:#FF6340;border-radius:16px;display:inline-block;padding:8px 16px;text-decoration:none" | ||
target="_blank" | ||
><span | ||
><!--[if mso | ||
]><i | ||
style="letter-spacing: 20px;mso-font-width:-100%;mso-text-raise:30" | ||
hidden | ||
> </i | ||
><! | ||
[endif]--></span | ||
><span>Activate an account</span | ||
><span | ||
><!--[if mso | ||
]><i | ||
style="letter-spacing: 20px;mso-font-width:-100%" | ||
hidden | ||
> </i | ||
><! | ||
[endif]--></span | ||
></a | ||
> | ||
</div> | ||
<div style="font-weight:normal;padding:16px 24px 16px 24px"> | ||
<p> | ||
If you have any questions or need assistance, don't | ||
hesitate to reach out to me directly via | ||
<a href="https://t.me/mrmike24" target="_blank">Telegram</a> | ||
or | ||
<a href="https://x.com/mrmegatelo" target="_blank">Twitter</a | ||
>. Your feedback is invaluable as the service continues to | ||
improve. I genuinely look forward to hearing about your | ||
experiences and how thewalter.app is making a difference for | ||
you. | ||
</p> | ||
</div> | ||
<div style="font-weight:normal;padding:16px 24px 16px 24px"> | ||
Thank you once again for joining us on this journey. Welcome to | ||
the Walter community – we’re so happy to have you here! | ||
</div> | ||
<div style="font-weight:normal;padding:16px 24px 16px 24px"> | ||
Warm regards, Mikhail | ||
</div> | ||
{% endblock %} | ||
Hi👋 I'm Mikhail, creator of thewalter.app. | ||
|
||
I hope this message finds you well! First and foremost, I want | ||
to extend my heartfelt thanks for your patience and enthusiasm. | ||
It means the world to me that you’re excited to be a part of thewalter.app. | ||
|
||
There only one thing left for you to is your account activation. | ||
|
||
To activate our account, simply click the link below and follow the instructions: | ||
<a href="{{ protocol }}://{{ site }}{% url 'django_registration_activate' %}?activation_key={{activation_key}}" | ||
target="_blank" | ||
>Activate an account</a> | ||
|
||
If you have any questions or need assistance, don't hesitate to reach out to me directly via | ||
<a href="https://t.me/mrmike24" target="_blank">Telegram</a> or <a href="https://x.com/mrmegatelo" target="_blank">Twitter</a>. | ||
Your feedback is invaluable as the service continues to improve. | ||
I genuinely look forward to hearing about your experiences and how thewalter.app is making a difference for you. | ||
|
||
Thank you once again for joining us on this journey. Welcome to the Walter community – we’re so happy to have you here! | ||
|
||
Warm regards, Mikhail |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
from . import index, edit, invite_username | ||
from .registration import RegistrationView | ||
|
||
__all__ = ['index', 'edit', 'invite_username'] | ||
__all__ = ['index', 'edit', 'invite_username', 'RegistrationView'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
from django.core.mail import send_mail | ||
from django.template.loader import render_to_string | ||
from django_registration.backends.activation.views import RegistrationView as BaseRegistrationView | ||
from django.conf import settings | ||
|
||
|
||
class RegistrationView(BaseRegistrationView): | ||
|
||
def send_activation_email(self, user): | ||
""" | ||
Custom method to enable HTML activation emails. | ||
""" | ||
activation_key = self.get_activation_key(user) | ||
context = self.get_email_context(activation_key) | ||
context['user'] = user | ||
subject = render_to_string( | ||
template_name=self.email_subject_template, | ||
context=context, | ||
request=self.request | ||
) | ||
# Force subject to a single line to avoid header-injection | ||
# issues. | ||
subject = ''.join(subject.splitlines()) | ||
text_content = render_to_string( | ||
template_name='activation_email_body.txt', | ||
context=context, | ||
request=self.request | ||
) | ||
html_content = render_to_string( | ||
template_name='activation_email_body.html', | ||
context=context, | ||
request=self.request | ||
) | ||
send_mail( | ||
subject, | ||
text_content, | ||
settings.DEFAULT_FROM_EMAIL, | ||
[user.email], | ||
html_message=html_content | ||
) |