Acquire.Identity._useraccount module¶
-
class
UserAccount(username=None)[source]¶ Bases:
objectThis class holds all information about a user’s account, e.g. their username, the sanitised username for the person on the system, their account keys, status etc.
This data can be serialised to an from json to allow easy saving a retrieval from an object store
-
login_request_timeout()[source]¶ Return the number of hours a login request will remain active. This should normally be short, e.g. 30 minutes
-
login_timeout()[source]¶ Return the maximum number of hours a single login can remain active. This should normally be of the order of 1-7 days, as individual calculations or workflows should not normally take longer than this
-
max_open_sessions()[source]¶ Return the maximum number of open login sessions (and open login requests) allowed for this user account
-
reset_password(password)[source]¶ Call this function to reset the password of this account. Note that this will reset the password, returning the new OTP used to generate the 2FA one-time-codes
-
static
sanitise_username(username)[source]¶ This function returns a sanitised version of the username. This will ensure that the username is valid (must be between 3 and 50 characters) and will remove anything problematic for the object store
-
set_keys(privkey, pubkey, secret=None)[source]¶ Set the private and public keys for this account. The keys can be set from files or from a binary read file..
-
validate_password(password, otpcode, remember_device=False, device_secret=None)[source]¶ Validate that the passed password and one-time-code are valid. If they are, then do nothing. Otherwise raise an exception. If ‘remember_device’ is true, then this returns the provisioning uri needed to initialise the OTP code for this account
-