Email Token

class privacyidea.lib.tokens.emailtoken.EmailTokenClass(aToken)[source]

Implementation of the EMail Token Class, that sends OTP values via SMTP. (Similar to SMSTokenClass)

check_otp(anOtpVal, counter=None, window=None, options=None)[source]

check the otpval of a token against a given counter and the window

Parameters:passw (string) – the to be verified passw/pin
Returns:counter if found, -1 if not found
Return type:int
create_challenge(transactionid=None, options=None)[source]

create a challenge, which is submitted to the user

  • transactionid – the id of this challenge
  • options – the request context parameters / data You can pass exception=1 to raise an exception, if the SMS could not be sent. Otherwise the message is contained in the response.

tuple of (bool, message and data) bool, if submit was successful message is submitted to the user data is preserved in the challenge attributes - additional attributes, which are displayed in the


static get_class_info(key=None, ret='all')[source]

returns all or a subtree of the token definition

  • key (string) – subsection identifier
  • ret (user defined) – default return value, if nothing is found

subsection if key exists or user defined

:rtype : s.o.

static get_class_prefix()[source]
static get_class_type()[source]

return the generic token class identifier

is_challenge_request(passw, user=None, options=None)[source]

check, if the request would start a challenge

We need to define the function again, to get rid of the is_challenge_request-decorator of the HOTP-Token

  • passw – password, which might be pin or pin+otp
  • options – dictionary of additional request parameters

returns true or false

classmethod test_config(params=None)[source]

This method is used to test the token config. Some tokens require some special token configuration like the SMS-Token or the Email-Token. To test this configuration, this classmethod is used.

It takes token specific parameters and returns a tuple of a boolean and a result description.

Parameters:params (dict) – token specific parameters
Returns:success, description
Return type:tuple
update(param, reset_failcount=True)[source]

update - process initialization parameters

Parameters:param (dict) – dict of initialization parameters