Module reahl.domain.systemaccountmodel

A collection of classes to deal with accounts for different parties on a system.


class reahl.domain.systemaccountmodel.AccountManagementInterface(**kwargs)

A session scoped object that @exposes a number of Fields and Events that user interface Widgets can use to access the functionality of this module.

Obtain an instance of AccountManagementInterface using AccountManagementInterface.for_current_session().

@exposed fields:

  • email: For input of any email address for use by Events.
  • new_email: For choosing a new email address (see events.change_email_event)
  • password: For typing a password for use by several Events.
  • repeat_password: For confirming a that fields.password was typed correctly.
  • stay_logged_in: Used when logging in to indicate that the user wishes to stay logged in for longer before the login times out.
  • secret: The secret key sent via email to verify the user’s identity.
  • accept_terms: Used when registering to indicate whether the user accepts the terms of the application.

@exposed events:

  • verify_event = Ask the system to verify the address entered.
  • register_event = Register a new account.
  • change_email_event = Requests a given email address to be changed.
  • investigate_event = Investigates whether a given email address is registered.
  • choose_password_event = Selects a new password given in fields.new_password (fields.secret should also be supplied).
  • reset_password_event = Requests that a password change be initiated (this will send a secret key to the current registered email).
  • login_event = Logs into the system using and fields.password
  • resend_event = Resends a secret of an outstanding request (to
  • log_out_event = Logs out the current account.


class reahl.domain.systemaccountmodel.LoginSession(**kwargs)

A @session_scoped object that keeps track of logged in access to the system.

(See AccountManagementInterface for logging users into and out of the system.)

New in version 3.1.


The SystemAccount currently logged on


Answers whether the user is logged in.

Parameters:secured – If True, ensures the login is done via secure means (such as an encrypted connection).

Changed in version 3.1: Moved here from the older UserSession, and the secured keyword argument was added.


class reahl.domain.systemaccountmodel.SystemAccount(**kwargs)

The credentials for someone to be able to log into the system.


The party to whom this account belongs.


The date when this account was first registered.


Whether this account is enabled or not


The number of failed login attempts using this account.


class reahl.domain.systemaccountmodel.EmailAndPasswordSystemAccount(**kwargs)

An EmailAndPasswordSystemAccount uses an email address to identify the account uniquely, and uses a password to authenticate login attempts.


The hashed password


The email address of this account


exception reahl.domain.systemaccountmodel.PasswordException(commit=False, message=None)

Whenever a new password is chosen, it is input by a user into two separate fields to guard against typing errors. PasswordException is raised to indicate that the two PasswordFields do not match.


exception reahl.domain.systemaccountmodel.InvalidPasswordException(commit=False, message=None)

Raised to indicate that a user supplied incorrect password or username.


exception reahl.domain.systemaccountmodel.KeyException(commit=False, message=None)

Raised to indicate that the secret key given is not valid.


exception reahl.domain.systemaccountmodel.InvalidEmailException(commit=False, message=None)

Raised to indicate that the given email address is not valid.


exception reahl.domain.systemaccountmodel.NoSuchAccountException(commit=False, message=None)

Raised to indicate that the account relating to a supplied email address does not exist.


exception reahl.domain.systemaccountmodel.NotUniqueException(commit=False, message=None)

Raised to indicate that an email address supplied for a new registration already is in use on the system.


exception reahl.domain.systemaccountmodel.AccountNotActiveException(account_status)

Raised to indicate that the account related to the given email address is not active yet.