pass ACCOUNT_ACTIVATION_DAYS to registration_complete template (fixes #22056)
This commit is contained in:
parent
aa70d7b321
commit
163f350506
|
@ -1301,14 +1301,15 @@ msgstr "Création du compte en cours"
|
|||
msgid ""
|
||||
"\n"
|
||||
" <p>An email was sent to %(email)s.</p>\n"
|
||||
" <p>Follow instruction in this email to continue your registration.</p>\n"
|
||||
" <p>Follow instruction in this email to continue your registration, this\n"
|
||||
" email will be valid during %(account_activation_days)s days.</p>\n"
|
||||
" <p><a href=\"%(homepage_url)s\">Back</a></p>\n"
|
||||
" "
|
||||
msgstr ""
|
||||
"\n"
|
||||
" <p>Un courriel a été envoyé à %(email)s.</p>\n"
|
||||
" <p>Suivez les instructions dans ce courriel pour continuer la création de "
|
||||
"votre compte.</p>\n"
|
||||
"votre compte, il restera valide pendant %(account_activation_days)s jours.</p>\n"
|
||||
" <p><a href=\"%(homepage_url)s\">Retour</a></p>\n"
|
||||
" "
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@ from django.conf.urls import url
|
|||
from django.views.generic.base import TemplateView
|
||||
from django.contrib.auth.decorators import login_required
|
||||
|
||||
from .views import RegistrationView, registration_completion, DeleteView
|
||||
from .views import RegistrationView, registration_completion, DeleteView, registration_complete
|
||||
|
||||
urlpatterns = patterns('',
|
||||
url(r'^activate/(?P<registration_token>[\w: -]+)/$',
|
||||
|
@ -13,7 +13,7 @@ urlpatterns = patterns('',
|
|||
RegistrationView.as_view(),
|
||||
name='registration_register'),
|
||||
url(r'^register/complete/$',
|
||||
TemplateView.as_view(template_name='registration/registration_complete.html'),
|
||||
registration_complete,
|
||||
name='registration_complete'),
|
||||
url(r'^register/closed/$',
|
||||
TemplateView.as_view(template_name='registration/registration_closed.html'),
|
||||
|
|
|
@ -9,6 +9,7 @@ from django.utils.translation import ugettext as _
|
|||
from django.contrib import messages
|
||||
from django.contrib.auth import REDIRECT_FIELD_NAME
|
||||
from django.core import signing
|
||||
from django.views.generic.base import TemplateView
|
||||
from django.views.generic.edit import FormView, CreateView
|
||||
from django.contrib.auth import get_user_model
|
||||
from django.forms import CharField, Form
|
||||
|
@ -382,3 +383,14 @@ class DeleteView(FormView):
|
|||
return super(DeleteView, self).form_valid(form)
|
||||
|
||||
registration_completion = valid_token(RegistrationCompletionView.as_view())
|
||||
|
||||
|
||||
class RegistrationCompleteView(TemplateView):
|
||||
template_name = 'registration/registration_complete.html'
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
return super(RegistrationCompleteView, self).get_context_data(
|
||||
account_activation_days=settings.ACCOUNT_ACTIVATION_DAYS,
|
||||
**kwargs)
|
||||
|
||||
registration_complete = RegistrationCompleteView.as_view()
|
||||
|
|
|
@ -9,7 +9,8 @@
|
|||
{% url "auth_homepage" as homepage_url %}
|
||||
{% blocktrans with email=request.session.registered_email %}
|
||||
<p>An email was sent to {{ email }}.</p>
|
||||
<p>Follow instruction in this email to continue your registration.</p>
|
||||
<p>Follow instruction in this email to continue your registration, this
|
||||
email will be valid during {{account_activation_days}} days.</p>
|
||||
<p><a href="{{ homepage_url }}">Back</a></p>
|
||||
{% endblocktrans %}
|
||||
{% endblock %}
|
||||
|
|
|
@ -28,6 +28,7 @@ def test_registration(app, db, settings, mailoutbox, external_redirect):
|
|||
assert urlparse(response['Location']).path == reverse('registration_complete')
|
||||
|
||||
response = response.follow()
|
||||
assert '2 days' in response.content
|
||||
assert 'testbot@entrouvert.com' in response.content
|
||||
assert len(mailoutbox) == 1
|
||||
|
||||
|
@ -92,7 +93,9 @@ def test_registration_realm(app, db, settings, mailoutbox):
|
|||
assert urlparse(response['Location']).path == reverse('registration_complete')
|
||||
|
||||
response = response.follow()
|
||||
assert '2 days' in response.content
|
||||
assert 'testbot@entrouvert.com' in response.content
|
||||
assert '2 days' in response.content
|
||||
assert len(mailoutbox) == 1
|
||||
|
||||
link = get_link_from_mail(mailoutbox[0])
|
||||
|
@ -144,6 +147,7 @@ def test_username_settings(app, db, settings, mailoutbox):
|
|||
assert urlparse(response['Location']).path == reverse('registration_complete')
|
||||
|
||||
response = response.follow()
|
||||
assert '2 days' in response.content
|
||||
assert 'testbot@entrouvert.com' in response.content
|
||||
assert len(mailoutbox) == 1
|
||||
link = get_link_from_mail(mailoutbox[0])
|
||||
|
@ -196,6 +200,7 @@ def test_username_is_unique(app, db, settings, mailoutbox):
|
|||
assert urlparse(response['Location']).path == reverse('registration_complete')
|
||||
|
||||
response = response.follow()
|
||||
assert '2 days' in response.content
|
||||
assert 'testbot@entrouvert.com' in response.content
|
||||
assert len(mailoutbox) == 1
|
||||
|
||||
|
@ -241,6 +246,7 @@ def test_email_is_unique(app, db, settings, mailoutbox):
|
|||
assert urlparse(response['Location']).path == reverse('registration_complete')
|
||||
|
||||
response = response.follow()
|
||||
assert '2 days' in response.content
|
||||
assert 'testbot@entrouvert.com' in response.content
|
||||
assert len(mailoutbox) == 1
|
||||
|
||||
|
@ -265,6 +271,7 @@ def test_email_is_unique(app, db, settings, mailoutbox):
|
|||
assert urlparse(response['Location']).path == reverse('registration_complete')
|
||||
|
||||
response = response.follow()
|
||||
assert '2 days' in response.content
|
||||
assert 'testbot@entrouvert.com' in response.content
|
||||
assert not 'This email address is already in use.' in response.content
|
||||
assert len(mailoutbox) == 3
|
||||
|
@ -300,6 +307,7 @@ def test_attribute_model(app, db, settings, mailoutbox):
|
|||
assert urlparse(response['Location']).path == reverse('registration_complete')
|
||||
|
||||
response = response.follow()
|
||||
assert '2 days' in response.content
|
||||
assert 'testbot@entrouvert.com' in response.content
|
||||
assert len(mailoutbox) == 1
|
||||
|
||||
|
@ -440,6 +448,7 @@ def test_revalidate_email(app, rf, db, settings, mailoutbox):
|
|||
response = response.form.submit()
|
||||
assert urlparse(response['Location']).path == reverse('registration_complete')
|
||||
response = response.follow()
|
||||
assert '2 days' in response.content
|
||||
assert 'johndoe@example.com' in response.content
|
||||
assert len(mailoutbox) == 1
|
||||
|
||||
|
|
Loading…
Reference in New Issue