Skip to content

Commit

Permalink
Merge remote-tracking branch 'pinax/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
Matt George committed May 24, 2012
2 parents 989aadf + 67ce6b1 commit b368472
Show file tree
Hide file tree
Showing 21 changed files with 663 additions and 100 deletions.
7 changes: 7 additions & 0 deletions .tx/config
@@ -0,0 +1,7 @@
[main]
host = https://www.transifex.net

[django-user-accounts.djangopo]
file_filter = account/locale/<lang>/LC_MESSAGES/django.po
source_lang = en
source_file = account/locale/en/LC_MESSAGES/django.po
1 change: 1 addition & 0 deletions README.rst
Expand Up @@ -9,6 +9,7 @@ Requirements

* Django 1.4
* django-appconf (included in ``install_requires``)
* pytz (included in ``install_requires``)

Documentation
=============
Expand Down
12 changes: 12 additions & 0 deletions account/admin.py
@@ -0,0 +1,12 @@
from django.contrib import admin

from account.models import SignupCode


class SignupCodeAdmin(admin.ModelAdmin):
list_display = ["code", "max_uses", "use_count", "expiry", "created"]
search_fields = ["code", "email"]
list_filter = ["created"]


admin.site.register(SignupCode, SignupCodeAdmin)
4 changes: 3 additions & 1 deletion account/conf.py
Expand Up @@ -15,15 +15,17 @@ class AccountAppConf(AppConf):
LOGOUT_REDIRECT_URL = "/"
PASSWORD_CHANGE_REDIRECT_URL = "account_password"
PASSWORD_RESET_REDIRECT_URL = "account_login"
REMEMBER_ME_EXPIRY = 60*60*24*365*10
USER_DISPLAY = lambda user: user.username
EMAIL_UNIQUE = True
EMAIL_CONFIRMATION_REQUIRED = False
EMAIL_CONFIRMATION_EMAIL = True
EMAIL_CONFIRMATION_EXPIRE_DAYS = 3
EMAIL_CONFIRMATION_ANONYMOUS_REDIRECT_URL = "account_login"
EMAIL_CONFIRMATION_AUTHENTICATED_REDIRECT_URL = None
SETTINGS_REDIRECT_URL = "account_settings"
CONTACT_EMAIL = "support@example.com"
TIMEZONE_CHOICES = list(zip(pytz.all_timezones, pytz.all_timezones))
TIMEZONES = zip(pytz.all_timezones, pytz.all_timezones)
LANGUAGES = [
(code, get_language_info(code).get("name_local"))
for code, lang in settings.LANGUAGES
Expand Down
2 changes: 1 addition & 1 deletion account/fields.py
Expand Up @@ -11,7 +11,7 @@ def __init__(self, *args, **kwargs):
defaults = {
"max_length": 100,
"default": settings.TIME_ZONE,
"choices": settings.ACCOUNT_TIMEZONE_CHOICES
"choices": settings.ACCOUNT_TIMEZONES
}
defaults.update(kwargs)
return super(TimeZoneField, self).__init__(*args, **defaults)
57 changes: 30 additions & 27 deletions account/forms.py
Expand Up @@ -21,11 +21,11 @@ class SignupForm(forms.Form):
widget=forms.TextInput(),
required=True
)
password1 = forms.CharField(
password = forms.CharField(
label=_("Password"),
widget=forms.PasswordInput(render_value=False)
)
password2 = forms.CharField(
password_confirm = forms.CharField(
label=_("Password (again)"),
widget=forms.PasswordInput(render_value=False)
)
Expand All @@ -52,8 +52,8 @@ def clean_email(self):
raise forms.ValidationError(_("A user is registered with this email address."))

def clean(self):
if "password1" in self.cleaned_data and "password2" in self.cleaned_data:
if self.cleaned_data["password1"] != self.cleaned_data["password2"]:
if "password" in self.cleaned_data and "password_confirm" in self.cleaned_data:
if self.cleaned_data["password"] != self.cleaned_data["password_confirm"]:
raise forms.ValidationError(_("You must type the same password each time."))
return self.cleaned_data

Expand Down Expand Up @@ -121,15 +121,15 @@ def user_credentials(self):

class ChangePasswordForm(forms.Form):

oldpassword = forms.CharField(
password_current = forms.CharField(
label=_("Current Password"),
widget=forms.PasswordInput(render_value=False)
)
password1 = forms.CharField(
password_new = forms.CharField(
label=_("New Password"),
widget=forms.PasswordInput(render_value=False)
)
password2 = forms.CharField(
password_new_confirm = forms.CharField(
label=_("New Password (again)"),
widget=forms.PasswordInput(render_value=False)
)
Expand All @@ -138,19 +138,19 @@ def __init__(self, *args, **kwargs):
self.user = kwargs.pop("user")
super(ChangePasswordForm, self).__init__(*args, **kwargs)

def clean_oldpassword(self):
if not self.user.check_password(self.cleaned_data.get("oldpassword")):
def clean_password_current(self):
if not self.user.check_password(self.cleaned_data.get("password_current")):
raise forms.ValidationError(_("Please type your current password."))
return self.cleaned_data["oldpassword"]
return self.cleaned_data["password_current"]

def clean_password2(self):
if "password1" in self.cleaned_data and "password2" in self.cleaned_data:
if self.cleaned_data["password1"] != self.cleaned_data["password2"]:
def clean_password_new_confirm(self):
if "password_new" in self.cleaned_data and "password_new_confirm" in self.cleaned_data:
if self.cleaned_data["password_new"] != self.cleaned_data["password_new_confirm"]:
raise forms.ValidationError(_("You must type the same password each time."))
return self.cleaned_data["password2"]
return self.cleaned_data["password_new_confirm"]

def save(self, user):
user.set_password(self.cleaned_data["password1"])
user.set_password(self.cleaned_data["password_new"])
user.save()


Expand All @@ -170,38 +170,41 @@ def clean_email(self):

class PasswordResetTokenForm(forms.Form):

password1 = forms.CharField(
password = forms.CharField(
label = _("New Password"),
widget = forms.PasswordInput(render_value=False)
)
password2 = forms.CharField(
password_confirm = forms.CharField(
label = _("New Password (again)"),
widget = forms.PasswordInput(render_value=False)
)

def clean_password2(self):
if "password1" in self.cleaned_data and "password2" in self.cleaned_data:
if self.cleaned_data["password1"] != self.cleaned_data["password2"]:
def clean_password_confirm(self):
if "password" in self.cleaned_data and "password_confirm" in self.cleaned_data:
if self.cleaned_data["password"] != self.cleaned_data["password_confirm"]:
raise forms.ValidationError(_("You must type the same password each time."))
return self.cleaned_data["password2"]
return self.cleaned_data["password_confirm"]


class SettingsForm(forms.Form):

email = forms.EmailField(label=_("Email"), required=True)
timezone = forms.ChoiceField(
label=_("Timezone"),
choices=settings.ACCOUNT_TIMEZONE_CHOICES,
required=False
)
language = forms.ChoiceField(
label=_("Language"),
choices=settings.ACCOUNT_LANGUAGES,
choices=settings.ACCOUNT_TIMEZONES,
required=False
)
if settings.USE_I18N:
language = forms.ChoiceField(
label=_("Language"),
choices=settings.ACCOUNT_LANGUAGES,
required=False
)

def clean_email(self):
value = self.cleaned_data["email"]
if self.initial.get("email") == value:
return value
qs = EmailAddress.objects.filter(email__iexact=value)
if not qs.exists() or not settings.ACCOUNT_EMAIL_UNIQUE:
return value
Expand Down
Binary file added account/locale/en/LC_MESSAGES/django.mo
Binary file not shown.
154 changes: 154 additions & 0 deletions account/locale/en/LC_MESSAGES/django.po
@@ -0,0 +1,154 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2012-05-15 13:38-0600\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"

#: forms.py:19 forms.py:92
msgid "Username"
msgstr ""

#: forms.py:25 forms.py:64
msgid "Password"
msgstr ""

#: forms.py:29
msgid "Password (again)"
msgstr ""

#: forms.py:41
msgid "Usernames can only contain letters, numbers and underscores."
msgstr ""

#: forms.py:45
msgid "This username is already taken. Please choose another."
msgstr ""

#: forms.py:52 forms.py:211
msgid "A user is registered with this email address."
msgstr ""

#: forms.py:57 forms.py:149 forms.py:185
msgid "You must type the same password each time."
msgstr ""

#: forms.py:68
msgid "Remember Me"
msgstr ""

#: forms.py:81
msgid "This account is inactive."
msgstr ""

#: forms.py:93
msgid "The username and/or password you specified are not correct."
msgstr ""

#: forms.py:108 forms.py:159 forms.py:191
msgid "Email"
msgstr ""

#: forms.py:109
msgid "The email address and/or password you specified are not correct."
msgstr ""

#: forms.py:125
msgid "Current Password"
msgstr ""

#: forms.py:129 forms.py:174
msgid "New Password"
msgstr ""

#: forms.py:133 forms.py:178
msgid "New Password (again)"
msgstr ""

#: forms.py:143
msgid "Please type your current password."
msgstr ""

#: forms.py:164
msgid "Email address not verified for any user account"
msgstr ""

#: forms.py:167
msgid "Email address not found for any user account"
msgstr ""

#: forms.py:193
msgid "Timezone"
msgstr ""

#: forms.py:199
msgid "Language"
msgstr ""

#: models.py:29
msgid "user"
msgstr ""

#: models.py:30
msgid "timezone"
msgstr ""

#: models.py:31
msgid "language"
msgstr ""

#: models.py:209
msgid "email address"
msgstr ""

#: models.py:210
msgid "email addresses"
msgstr ""

#: models.py:246
msgid "email confirmation"
msgstr ""

#: models.py:247
msgid "email confirmations"
msgstr ""

#: views.py:36
#, python-format
msgid "Confirmation email sent to %(email)s."
msgstr ""

#: views.py:40
#, python-format
msgid "Successfully logged in as %(user)s."
msgstr ""

#: views.py:44
#, python-format
msgid "The code %(code)s is invalid."
msgstr ""

#: views.py:267
#, python-format
msgid "You have confirmed %(email)s."
msgstr ""

#: views.py:340 views.py:441
msgid "Password successfully changed."
msgstr ""

#: views.py:502
msgid "Account settings updated."
msgstr ""
Binary file added account/locale/es/LC_MESSAGES/django.mo
Binary file not shown.

0 comments on commit b368472

Please sign in to comment.