1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-20 19:08:21 +00:00

Fix account registrion email bug

This commit is contained in:
zhengxie
2015-05-09 10:38:42 +08:00
parent ede9f20319
commit d1bd33afc2
4 changed files with 42 additions and 10 deletions

View 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 %}

View File

@@ -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://{{ site.name }}{{ SITE_ROOT }}accounts/activate/{{ activation_key }}/
http{% if request.is_secure %}s{% endif %}://{{ request.get_host }}{% url 'registration_activate' activation_key %}
http://{{site.domain}}{% url 'registration_activate' activation_key %}
{% blocktrans with site_name=site.name %}
Sincerely,
{{ site_name }} Management
{% endblocktrans %}

View File

@@ -1 +1 @@
请激活您的帐号,完成注册。
{% load i18n %}{% trans "Account activation on" %} {{ site.name }}

View File

@@ -11,7 +11,7 @@ from django.template.loader import render_to_string
from django.utils.translation import ugettext_lazy as _
from seahub.base.accounts import User
from seahub.utils import send_html_email
SHA1_RE = re.compile('^[a-f0-9]{40}$')
@@ -279,13 +279,10 @@ class RegistrationProfile(models.Model):
ctx_dict)
# Email subject *must not* contain newlines
subject = ''.join(subject.splitlines())
message = render_to_string('registration/activation_email.txt',
ctx_dict)
try:
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:
pass