Skip to content
This repository has been archived by the owner on Aug 20, 2018. It is now read-only.

Commit

Permalink
Merge pull request #161 from bobsilverberg/fix_pp_bug
Browse files Browse the repository at this point in the history
Bug 1039778 - Error submitting the privacy policy
  • Loading branch information
bobsilverberg committed Jul 17, 2014
2 parents b38bddc + 6ff726b commit 999d509
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 13 deletions.
22 changes: 14 additions & 8 deletions oneanddone/users/forms.py
Expand Up @@ -6,24 +6,30 @@


class SignUpForm(forms.ModelForm):
privacy_policy_accepted = forms.BooleanField(
label = _("You are creating a profile that will include a public username and work history. You will begin to receive email communications from Mozilla once you have completed tasks. You may unsubscribe at anytime by clicking the line at the bottom of these emails."),
required = True,)
pp_checkbox = forms.BooleanField(
label=_("You are creating a profile that will include a public username and work history. You will begin to receive email communications from Mozilla once you have completed tasks. You may unsubscribe at anytime by clicking the line at the bottom of these emails."),
required=True,
initial=True)
username = forms.RegexField(
label= _("Username:"),
label=_("Username:"),
max_length=30, regex=r'^[a-zA-Z0-9]+$',
error_messages = {'invalid': _("This value may contain only alphanumeric characters.")})
error_messages={'invalid': _("This value may contain only alphanumeric characters.")})

class Meta:
model = UserProfile
fields = ('name', 'username', 'privacy_policy_accepted')
fields = ('name', 'username', 'pp_checkbox')

def save(self, *args, **kwargs):
# We will only reach the save() method if the pp_checkbox was checked
self.instance.privacy_policy_accepted = True
super(SignUpForm, self).save(*args, **kwargs)


class UserProfileForm(forms.ModelForm):
username = forms.RegexField(
label= _("Username:"),
label=_("Username:"),
max_length=30, regex=r'^[a-zA-Z0-9]+$',
error_messages = {'invalid': _("This value may contain only alphanumeric characters.")})
error_messages={'invalid': _("This value may contain only alphanumeric characters.")})

class Meta:
model = UserProfile
Expand Down
10 changes: 5 additions & 5 deletions oneanddone/users/templates/users/profile/edit.html
Expand Up @@ -21,19 +21,19 @@ <h1>{{ _('Profile') }}</h1>
https://oneanddone.mozilla.org/profile/
{{ form.username }}
</p>
{% if form.privacy_policy_accepted %}
{% if form.pp_checkbox %}
<p class="billboard content-container">
{{form.privacy_policy_accepted.label}}
{{form.pp_checkbox.label}}
</p>
{{form.privacy_policy_accepted.errors}}
{{form.pp_checkbox.errors}}
<p>
{{form.privacy_policy_accepted}}
{{form.pp_checkbox}}
{{_("* I'm okay with you handling this info as you explain in <a href='https://www.mozilla.org/en-US/privacy/websites/' target='_blank'>Mozilla's Privacy Policy</a>.")}}
</p>
{% endif %}
<div class="actions-container">
{% if action == 'Update' %}
{% if form.privacy_policy_accepted %}
{% if form.pp_checkbox %}
<a href="{{ url('users.profile.delete') }}" id="delete-profile" class="button">{{ _('I Disagree, Delete Profile') }}</a>
{% else %}
<a href="{{ url('users.profile.delete') }}" id="delete-profile" class="button">{{ _('Delete Profile') }}</a>
Expand Down

0 comments on commit 999d509

Please sign in to comment.