mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-20 10:58:33 +00:00
Fix account registrion email bug
This commit is contained in:
21
seahub/templates/registration/activation_email.html
Normal file
21
seahub/templates/registration/activation_email.html
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
{% extends 'email_base.html' %}
|
||||||
|
|
||||||
|
{% load i18n %}
|
||||||
|
|
||||||
|
{% block email_con %}
|
||||||
|
|
||||||
|
{% autoescape off %}
|
||||||
|
|
||||||
|
<p style="color:#121214;font-size:14px;">{% trans "Hi," %}</p>
|
||||||
|
|
||||||
|
<p style="font-size:14px;color:#434144;">
|
||||||
|
{% blocktrans %}You (or someone pretending to be you) have asked to register an account at {{ site_name }}. If this wasn't you, please ignore this email and your address will be removed from our records.{% endblocktrans %}
|
||||||
|
<br />
|
||||||
|
{% blocktrans %}To activate this account, please click the following link within the next {{ expiration_days }} days: {% endblocktrans %}
|
||||||
|
<br />
|
||||||
|
{{ url_base }}{% url 'registration_activate' activation_key %}
|
||||||
|
</p>
|
||||||
|
|
||||||
|
{% endautoescape %}
|
||||||
|
|
||||||
|
{% endblock %}
|
@@ -1,4 +1,18 @@
|
|||||||
您好, 感谢注册 {{ site.name }}。
|
{% load i18n %}
|
||||||
|
{% blocktrans with site_name=site.name %}
|
||||||
|
You (or someone pretending to be you) have asked to register an account at
|
||||||
|
{{ site_name }}. If this wasn't you, please ignore this email
|
||||||
|
and your address will be removed from our records.
|
||||||
|
{% endblocktrans %}
|
||||||
|
{% blocktrans %}
|
||||||
|
To activate this account, please click the following link within the next
|
||||||
|
{{ expiration_days }} days:
|
||||||
|
{% endblocktrans %}
|
||||||
|
|
||||||
请点击下面的链接激活您的帐号
|
http{% if request.is_secure %}s{% endif %}://{{ request.get_host }}{% url 'registration_activate' activation_key %}
|
||||||
http://{{ site.name }}{{ SITE_ROOT }}accounts/activate/{{ activation_key }}/
|
http://{{site.domain}}{% url 'registration_activate' activation_key %}
|
||||||
|
|
||||||
|
{% blocktrans with site_name=site.name %}
|
||||||
|
Sincerely,
|
||||||
|
{{ site_name }} Management
|
||||||
|
{% endblocktrans %}
|
||||||
|
@@ -1 +1 @@
|
|||||||
请激活您的帐号,完成注册。
|
{% load i18n %}{% trans "Account activation on" %} {{ site.name }}
|
||||||
|
@@ -11,7 +11,7 @@ from django.template.loader import render_to_string
|
|||||||
from django.utils.translation import ugettext_lazy as _
|
from django.utils.translation import ugettext_lazy as _
|
||||||
|
|
||||||
from seahub.base.accounts import User
|
from seahub.base.accounts import User
|
||||||
|
from seahub.utils import send_html_email
|
||||||
|
|
||||||
SHA1_RE = re.compile('^[a-f0-9]{40}$')
|
SHA1_RE = re.compile('^[a-f0-9]{40}$')
|
||||||
|
|
||||||
@@ -279,13 +279,10 @@ class RegistrationProfile(models.Model):
|
|||||||
ctx_dict)
|
ctx_dict)
|
||||||
# Email subject *must not* contain newlines
|
# Email subject *must not* contain newlines
|
||||||
subject = ''.join(subject.splitlines())
|
subject = ''.join(subject.splitlines())
|
||||||
|
|
||||||
message = render_to_string('registration/activation_email.txt',
|
|
||||||
ctx_dict)
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
user = User.objects.get(id=self.emailuser_id)
|
user = User.objects.get(id=self.emailuser_id)
|
||||||
user.email_user(subject, message, settings.DEFAULT_FROM_EMAIL)
|
send_html_email(subject, 'registration/activation_email.html',
|
||||||
|
ctx_dict, None, [user.username])
|
||||||
except User.DoesNotExist:
|
except User.DoesNotExist:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user