gws.plugin.account.account_action

Action for the account onboarding procedure.

Source code: gws.plugin.account.account_action

Module Contents

class gws.plugin.account.account_action.Config

Bases: gws.base.action.Config

Account management for end users, including onboarding.

class gws.plugin.account.account_action.MfaProps(*args, **kwargs)

Bases: gws.Data

MFA method offered to the user during onboarding.

index: int

Index of the method in the helper’s mfa list, starting with 1.

qrCode: str

QR code of the key URI as a data URL, empty if the method has no key URI.

title: str

Title of the method.

class gws.plugin.account.account_action.Object

Bases: gws.base.action.Object

Account action, provides the onboarding API for the client.

The onboarding steps are: start, set the password, select an MFA method (only if MFA methods are configured). Each step requires the temporary code returned by the previous step, the first one the code from the onboarding link.

h: gws.plugin.account.helper.Object

The account helper.

configure()
get_account_by_tc(tc, category, expected_status)

Find an account by a temporary code.

The code is invalidated.

Parameters:
  • tc – Temporary code.

  • category – Expected code category.

  • expected_status – Expected account status.

Returns:

The account record.

Raises:

gws.ForbiddenError – If no valid account is found.

mfa_props(account: dict, mfa_secret)

Create props for the MFA methods available to an account.

Parameters:
  • account – Account record.

  • mfa_secret – MFA secret for the QR codes.

Returns:

A list of MfaProps.

onboarding_save_mfa(req: gws.WebRequester, p: OnboardingSaveMfaRequest) → OnboardingSaveMfaResponse

Save the selected MFA method and activate the account.

onboarding_save_password(req: gws.WebRequester, p: OnboardingSavePasswordRequest) → OnboardingSavePasswordResponse

Set the password of the account.

onboarding_start(req: gws.WebRequester, p: OnboardingStartRequest) → OnboardingStartResponse

Start the account onboarding.

class gws.plugin.account.account_action.OnboardingSaveMfaRequest(*args, **kwargs)

Bases: gws.Request

Request to select an MFA method during onboarding.

mfaIndex: int | None

Index of the selected method.

tc: str

Temporary code from the previous step.

class gws.plugin.account.account_action.OnboardingSaveMfaResponse(*args, **kwargs)

Bases: gws.Response

Response to selecting an MFA method.

complete: bool

True when the onboarding is complete.

completionUrl: str

URL to go to when the onboarding is complete.

class gws.plugin.account.account_action.OnboardingSavePasswordRequest(*args, **kwargs)

Bases: gws.Request

Request to set the password during onboarding.

email: str

Email address, must match the account’s email.

password1: str

New password.

password2: str

New password, repeated.

tc: str

Temporary code from the previous step.

class gws.plugin.account.account_action.OnboardingSavePasswordResponse(*args, **kwargs)

Bases: gws.Response

Response to setting the password.

complete: bool

True if the account is active, False if an MFA method must be selected.

completionUrl: str

URL to go to when the onboarding is complete.

mfaList: list[MfaProps]

MFA methods to choose from.

ok: bool

False if the email does not match or the password is invalid.

tc: str

New temporary code for the next step, if the onboarding is not complete.

class gws.plugin.account.account_action.OnboardingStartRequest(*args, **kwargs)

Bases: gws.Request

Request to start the onboarding.

tc: str

Temporary code from the onboarding link.

class gws.plugin.account.account_action.OnboardingStartResponse(*args, **kwargs)

Bases: gws.Response

Response to the onboarding start.

tc: str

New temporary code for the next step.

class gws.plugin.account.account_action.Props

Bases: gws.base.action.Props