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)¶ 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
-