send_tfa_code

send_tfa_code Sends a TFA (Two Factor Authorization) code to a user via email. This function may be called two different ways, withe by passing it an email address, or a clouduser object

Formats:

send_tfa_code(email [,subject] [,body] [,from] [,html_format] )
send_tfa_code(user [,subject] [,body] [,from] [,html_format] )

Parameters:

Parameter Type Description
email_or_user multiple The email of the recipient user, OR a cloudouser object
subject string  [Optional]The subject of the email. defaults to "Authorization Code"
from string  [Optional]The name of the sender. defaults to "Mobile Appplication"
body string  [Optional]The body of the email. MUST unclude the string %CODE% which will be replaced with the Two Factor authorization code. HTML tags may be used unless the html_format parameter is passed as FALSE
html_format boolean  [Optional]Specifies weather HTML format should be used for the email. default is TRUE

Returned Value:

Type Description
string "OK" if the operation succeeded, or an error message otherwise.

Examples

 res = send_tfa_code("mickey@mouse.com", "Your login code", "Disney" )
 if (res == "OK") {
     alert("An authorization code was sent to you via e-mail.")
 }
 else {
     alert(res)
 }