Documentation versions

Module reahl.domain.systemaccountmodel

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

AccountManagementInterface

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 fields.email 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 fields.email and fields.password
  • resend_event = Resends a secret of an outstanding request (to fields.email).
  • log_out_event = Logs out the current account.

LoginSession

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.

account

The SystemAccount currently logged on

is_logged_in(secured=False)

Answers whether the user is logged in.

Parameters:secure – 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.

SystemAccount

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

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

owner

The party to whom this account belongs.

registration_date

The date when this account was first registered.

account_enabled

Whether this account is enabled or not

failed_logins

The number of failed loin attempts using this account.

EmailAndPasswordSystemAccount

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

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

PasswordException

exception reahl.domain.systemaccountmodel.PasswordException(commit=False)

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.

InvalidPasswordException

exception reahl.domain.systemaccountmodel.InvalidPasswordException(commit=False)

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

KeyException

exception reahl.domain.systemaccountmodel.KeyException(commit=False)

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

InvalidEmailException

exception reahl.domain.systemaccountmodel.InvalidEmailException(commit=False)

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

NoSuchAccountException

exception reahl.domain.systemaccountmodel.NoSuchAccountException(commit=False)

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

NotUniqueException

exception reahl.domain.systemaccountmodel.NotUniqueException(commit=False)

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

AccountNotActiveException

exception reahl.domain.systemaccountmodel.AccountNotActiveException(account_status)

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

Documentation versions