apicrud.messaging.confirmation¶
confirmation.py
- Confirmation
Handle the request and confirm actions for a contact.
created 4-apr-2020 by richb@instantlinux.net
Classes
|
Functions for confirming ownership of online email/contact info |
|
Works like |
|
These are keys in a user-provided dict; see the example/i18n_textstrings.py for how to assign string templates for messaging. |
Exceptions
|
A database result was required but none was found. |
-
class
apicrud.messaging.confirmation.
Confirmation
(config, models)¶ Functions for confirming ownership of online email/contact info
- Parameters
config (obj) – the config-file key-value object
models (obj) – the models file object
-
confirm
(token)¶ Confirm a contact if token is still valid
- Parameters
token (str) – the token generated previously
- Returns
first item is dict with fields as defined in SessionManager.create, second item is the http response code
- Return type
tuple
-
request
(id, ttl=None, message='contact_add', func_send=None)¶ Generate a confirmation token valid for a given period, and send it to the contact identified by id
- Parameters
id (str) – record ID in contacts table of database
ttl (int) – how many seconds before token expires
message (str) – key in i18n dict for contact-add message
func_send (function) – name of function for sending message
- Returns
first item is dict with token and contact-ID, second is the http response code
- Return type
tuple