Reference

This document covers various components of pinax.apps.account.

Settings

ACCOUNT_EMAIL_VERIFICATION

Required. This setting is used to control whether or not email verification is sent upon signup:

ACCOUNT_EMAIL_VERIFICATION = True

LOGIN_REDIRECT_URLNAME

The name defined in the URLconf that maps to the url that the user will be redirected to after login success.

LOGIN_REDIRECT_URLNAME = "home"

STATIC_URL

Required. An URL for static files that need serving.

STATIC_URL = "/static/"

ACCOUNT_OPEN_SIGNUP

Required. Permit signing up for an account via OpenID.

ACCOUNT_OPEN_SIGNUP = True

Named URLs

The named URLs in this app should enable the use of of the {% url %} template tag as well as reverse lookups in your project code without having to know the implementation details of this app.

acct_email

This is the URL that on POST will process a number of actions related to an email address on an account and on GET will render a template that provides the email form in context.

acct_signup

This URL will process a form to create an account on POST and render a template with a signup form instance in context on GET requests.

acct_login

Process a login request from POST requests and render a template with a login form instance in context on GET requests.

acct_login_openid

Process the login POST request while associating submitted OpenID credentials to the account if they don’t already exist.

acct_passwd

Process a password change form POST or render a template with a password change form instance in context.

acct_passwd_set

Process a password set form POST or render a template with a password set form instance in context.

acct_passwd_delete

Process a password delete form POST or render a template with a password delete form instance in context.

acct_passwd_delete_done

Renders static template to inform user that the password delete is complete.

acct_timezone_change

Processes a timezone form POST request to change a user’s timezone or renders a template with the timezone change form instance in context.

acct_other_services

Adds credentials for Twitter on form POST, or renders a template with the form instance in context.

acct_other_services_remove

Removes Twitter account association with user.

acct_language_change

Processes a default language selection form POST request or renders a template with the language change form in context.

acct_logout

Calls the django.contrib.auth.views.logout view.

acct_confirm_email

Calls the emailconfirmation.views.confirm_email view.

arguments:The token generated in the emailconfirmation app that matches (\w+).

acct_passwd_reset

Process a password reset form POST request and redirect to acct_passwd_reset_done or render a template with the password reset form instance in context.

acct_passwd_reset_done

Renders a template confirming the password reset process is complete.

acct_passwd_reset_key

Process a password reset using user key form POST request or render a template with the form in context.

keyword arguments:
 The UUID and Key for the reset reset request that matches (?P<uidb36>[0-9A-Za-z]+)-(?P<key>.+)

signup_form_validate

Calls the ajax_validation.views.validate view with the pinax.apps.account.forms.SignupForm.

Templates

Templates should be placed in an account/ folder at the root of one of your template search paths.

login.html

context:group, form, url_required, redirect_field_name, redirect_field_value

signup.html

context:group, form, redirect_field_name, redirect_field_value

verification_sent.html

context:group, email, success_url

email.html

context:group, add_email_form

password_change.html

context:group, password_change_form

password_set.html

context:group, password_set_form

password_delete.html

context:group

password_delete_done.html

context:None

password_reset.html

context:group, password_reset_form

password_reset_done.html

context:group

password_reset_from_key.html

If there is a valid token:

context:group, form

otherwise:

context:group, token_fail = True

timezone_change.html

context:group, form

language_change.html

context:group, form

other_services.html

context:group, twitter_form, twitter_authorized

Modules

pinax.apps.account.admin

class pinax.apps.account.admin.PasswordResetAdmin(model, admin_site)
media

pinax.apps.account.auth_backends

class pinax.apps.account.auth_backends.EmailModelBackend

A backend that provides authentication through e-mail instead of username.

authenticate(email=None, password=None)

pinax.apps.account.context_processors

pinax.apps.account.context_processors.account(request)

pinax.apps.account.forms

class pinax.apps.account.forms.AccountForm(*args, **kwargs)
media
class pinax.apps.account.forms.AddEmailForm(user=None, *args, **kwargs)
clean_email()
media
save()
class pinax.apps.account.forms.ChangeLanguageForm(*args, **kwargs)
media
save()
class pinax.apps.account.forms.ChangePasswordForm(user=None, *args, **kwargs)
clean_oldpassword()
clean_password2()
media
save()
class pinax.apps.account.forms.ChangeTimezoneForm(*args, **kwargs)
media
save()
class pinax.apps.account.forms.GroupForm(*args, **kwargs)
media
class pinax.apps.account.forms.LoginForm(*args, **kwargs)
clean()
login(request)
media
user_credentials()
Provides the credentials required to authenticate the user for login.
class pinax.apps.account.forms.OpenIDSignupForm(*args, **kwargs)
media
class pinax.apps.account.forms.ResetPasswordForm(data=None, files=None, auto_id='id_%s', prefix=None, initial=None, error_class=<class 'django.forms.util.ErrorList'>, label_suffix=':', empty_permitted=False)
clean_email()
media
save(**kwargs)
class pinax.apps.account.forms.ResetPasswordKeyForm(*args, **kwargs)
clean_password2()
media
save()
class pinax.apps.account.forms.SetPasswordForm(user=None, *args, **kwargs)
clean_password2()
media
save()
class pinax.apps.account.forms.SignupForm(*args, **kwargs)
after_signup(user, **kwargs)
An extension point for subclasses.
clean()
clean_email()
clean_username()
create_user(username=None, commit=True)
login(request, user)
media
save(request=None)
class pinax.apps.account.forms.TwitterForm(*args, **kwargs)
media
save()
class pinax.apps.account.forms.UserForm(user=None, *args, **kwargs)
media

pinax.apps.account.middleware

class pinax.apps.account.middleware.AuthenticatedMiddleware(login_url=None, redirect_field_name='next')
process_request(request)
class pinax.apps.account.middleware.LocaleMiddleware

This is a very simple middleware that parses a request and decides what translation object to install in the current thread context depending on the user’s account. This allows pages to be dynamically translated to the language the user desires (if the language is available, of course).

get_language_for_user(request)
process_request(request)
process_response(request, response)

pinax.apps.account.models

class pinax.apps.account.models.Account(*args, **kwargs)

Account(id, user_id, timezone, language)

exception DoesNotExist
exception Account.MultipleObjectsReturned
Account.get_language_display(*moreargs, **morekwargs)
Account.get_timezone_display(*moreargs, **morekwargs)
Account.user
class pinax.apps.account.models.AnonymousAccount(request=None)
class pinax.apps.account.models.OtherServiceInfo(*args, **kwargs)

OtherServiceInfo(id, user_id, key, value)

exception DoesNotExist
exception OtherServiceInfo.MultipleObjectsReturned
OtherServiceInfo.user
class pinax.apps.account.models.PasswordReset(*args, **kwargs)

PasswordReset(id, user_id, temp_key, timestamp, reset)

exception DoesNotExist
exception PasswordReset.MultipleObjectsReturned
PasswordReset.get_next_by_timestamp(*moreargs, **morekwargs)
PasswordReset.get_previous_by_timestamp(*moreargs, **morekwargs)
PasswordReset.user
pinax.apps.account.models.create_account(sender, instance=None, **kwargs)
pinax.apps.account.models.mark_user_active(sender, instance=None, **kwargs)
pinax.apps.account.models.other_service(user, key, default_value='')

retrieve the other service info for given key for the given user.

return default_value (“”) if no value.

pinax.apps.account.models.superuser_email_address(sender, instance=None, **kwargs)
pinax.apps.account.models.update_other_services(user, **kwargs)

update the other service info for the given user using the given keyword args.

e.g. update_other_services(user, twitter_user=..., twitter_password=...)

pinax.apps.account.openid_consumer

pinax.apps.account.signals

pinax.apps.account.templatetags.account_tags

class pinax.apps.account.templatetags.account_tags.UserDisplayNode(user, as_var=None)
render(context)
pinax.apps.account.templatetags.account_tags.do_user_display(parser, token)

Example usage:

{% user_display user %}

or if you need to use in a {% blocktrans %}:

{% user_display user as user_display}
{% blocktrans %}{{ user_display }} has sent you a gift.{% endblocktrans %}

pinax.apps.account.templatetags.openid_tags

class pinax.apps.account.templatetags.openid_tags.IfOpenidNode(nodelist_true, nodelist_false)
render(context)
pinax.apps.account.templatetags.openid_tags.ifopenid(parser, token)

pinax.apps.account.templatetags.other_service_tags

class pinax.apps.account.templatetags.other_service_tags.OtherServiceNode(user, key, asvar)
render(context)
pinax.apps.account.templatetags.other_service_tags.other_service_tag(parser, token)

pinax.apps.account.utils

pinax.apps.account.utils.get_default_redirect(request, redirect_field_name='next', login_redirect_urlname='', session_key_value='redirect_to')

Returns the URL to be used in login procedures by looking at different values in the following order:

  • a REQUEST value, GET or POST, named “next” by default.
  • LOGIN_REDIRECT_URL - the URL in the setting
  • LOGIN_REDIRECT_URLNAME - the name of a URLconf entry in the settings
pinax.apps.account.utils.has_openid(request)
Given a HttpRequest determine whether the OpenID on it is associated thus allowing caller to know whether OpenID is good to depend on.
pinax.apps.account.utils.perform_login(request, user)
pinax.apps.account.utils.user_display(user)

pinax.apps.account.views