example.controllers.account¶
account controller
created 31-mar-2019 by richb@instantlinux.net
Functions
|
Record IDs are random 48-bit RFC-4648 radix-64 with a fixed prefix to make them (somewhat) more human-recognizable |
Classes
|
Controller base class |
|
Functions for confirming ownership of online email/contact info |
|
Session Authorization |
Exceptions
|
A database result was required but none was found. |
-
class
example.controllers.account.
AccountController
¶ -
static
change_password
(uid, body)¶ Change password
- Parameters
body (dict) – Fields new_password, verify_password are required; either the old_password or a reset_token can be used to authorized the request.
- Returns
dict with account_id/uid/username, http response
- Return type
tuple
-
static
create
(body)¶ Controller for POST endpoints. This method assigns a new object ID, sets the _created_ timestamp, evaluates user’s permissions, adds a default category_id if the model has this attribute, and inserts a row to the back-end database.
- Parameters
body (dict) – resource fields as defined by openapi.yaml schema
id_prefix (str) – generated objects will be assigned a random 10- to 16-character ID; you can set a unique prefix if desired
- Returns
first element is a dict with the id, second element is response code (201 on success)
- Return type
tuple
-
static
get_password
(uid)¶ Dummy get_password function is needed for react-admin’s edit workflow (a get must precede put)
- Parameters
uid (str) – User ID
-
static
register
(body)¶ Register a new account
- Parameters
body (dict) – If forgot_password is set, send an email with reset token. Otherwise examine username, identity (email address) and name fields. Reject the new account if a duplicate identity or username already exists. Otherwise add the new account with Person and primary Contact objects. Finally send a confirmation email to the primary contact address.
- Returns
id of account created, and http status
- Return type
tuple
-
static