More registration form cleanup.

This commit is contained in:
Diana Huang
2017-12-07 13:02:29 -05:00
parent f9623fc96a
commit 0ecc0558a3
4 changed files with 15 additions and 9 deletions

View File

@@ -786,13 +786,14 @@ class RegistrationFormFactory(object):
# in order to register a new account.
terms_label = _(u"Terms of Service")
terms_link = marketing_link("TOS")
terms_text = _(u"Review the Terms of Service")
# Translators: "Terms of service" is a legal document users must agree to
# in order to register a new account.
label = _(u"I agree to the {platform_name} {terms_of_service}").format(
label = Text(_(u"I agree to the {platform_name} {tos_link_start}{terms_of_service}{tos_link_end}")).format(
platform_name=configuration_helpers.get_value("PLATFORM_NAME", settings.PLATFORM_NAME),
terms_of_service=terms_label
terms_of_service=terms_label,
tos_link_start=HTML("<a href='{terms_link}' target='_blank'>").format(terms_link=terms_link),
tos_link_end=HTML("</a>"),
)
# Translators: "Terms of service" is a legal document users must agree to
@@ -811,8 +812,6 @@ class RegistrationFormFactory(object):
error_messages={
"required": error_msg
},
supplementalLink=terms_link,
supplementalText=terms_text
)
def _apply_third_party_auth_overrides(self, request, form_desc):

View File

@@ -1593,12 +1593,13 @@ class RegistrationViewTest(ThirdPartyAuthTestMixin, UserAPITestCase):
# Terms of service field should also be present
link_label = "Terms of Service"
link_template = "<a href='https://www.test.com/tos' target='_blank'>{link_label}</a>"
self._assert_reg_field(
{"honor_code": "required", "terms_of_service": "required"},
{
"label": u"I agree to the {platform_name} {link_label}".format(
platform_name=settings.PLATFORM_NAME,
link_label=link_label
link_label=link_template.format(link_label=link_label)
),
"name": "terms_of_service",
"defaultValue": False,
@@ -1640,12 +1641,13 @@ class RegistrationViewTest(ThirdPartyAuthTestMixin, UserAPITestCase):
link_label = 'Terms of Service'
# Terms of service field should also be present
link_template = "<a href='/tos' target='_blank'>{link_label}</a>"
self._assert_reg_field(
{"honor_code": "required", "terms_of_service": "required"},
{
"label": u"I agree to the {platform_name} {link_label}".format(
platform_name=settings.PLATFORM_NAME,
link_label=link_label
link_label=link_template.format(link_label=link_label)
),
"name": "terms_of_service",
"defaultValue": False,