Module reahl.systemaccountmodel

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

AccountManagementInterface

class reahl.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.

UserSession

class reahl.systemaccountmodel.UserSession(**kwargs)

An implementation of reahl.interfaces.UserSessionProtocol of the Reahl framework.

SystemAccount

class reahl.systemaccountmodel.SystemAccount(**kwargs)

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

party = Property(party, <class 'reahl.systemaccountmodel.SystemAccount'>)

The party tho whom this account belongs.

registration_date = Property(registration_date, <class 'reahl.systemaccountmodel.SystemAccount'>)

The date when this account was first registered.

account_enabled = Property(account_enabled, <class 'reahl.systemaccountmodel.SystemAccount'>)

Whether this account is enabled or not

failed_logins = Property(failed_logins, <class 'reahl.systemaccountmodel.SystemAccount'>)

The number of failed loin attempts using this account.

EmailAndPasswordSystemAccount

class reahl.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.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.systemaccountmodel.InvalidPasswordException(commit=False)

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

KeyException

exception reahl.systemaccountmodel.KeyException(commit=False)

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

InvalidEmailException

exception reahl.systemaccountmodel.InvalidEmailException(commit=False)

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

NoSuchAccountException

exception reahl.systemaccountmodel.NoSuchAccountException(commit=False)

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

NotUniqueException

exception reahl.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.systemaccountmodel.AccountNotActiveException(account_status)

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