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; class attributes are passed through the service config. |
-
class
apicrud.messaging.confirmation.
Confirmation
¶ Functions for confirming ownership of online email/contact info; class attributes are passed through the service config.
-
token_salt
¶ salt value for serializer token
- Type
str
-
token_secret
¶ a secret to validate upon confirmation
- Type
str
-
token_timeout
¶ seconds until expiration
- Type
int
-
confirm
(token, clear_session=False)¶ Confirm a contact if token is still valid
- Parameters
token (str) – the token generated previously
clear_session (bool) – whether to wipe out token after use
- 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, template='contact_add')¶ 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
template (str) – jinja2 template name contact-add message
- Returns
first item is dict with token and contact-ID, second is the http response code
- Return type
tuple
-