verify_tfa_code
verify_tfa_code Verifies that a TFA (Two Factor Authorization) code matches the one most recently sent via email using send_tfa_code
only one successful result
if this function returns true, it will eliminate the TFA code that is stored in the session, so subsequent calls will not work unless and until another call to send_tfa_code is made
default life-span is ten minutes
TFA codes will only be valid for ten minutes by default. you can specify a longer time by passing a value for the optional lifespan parameter
A TFA code can only be verified by the user that sent it.
TFA codes are stored in the session, so the person entering a TFA code for verification must be the same user that sent it.
Format:
verify_tfa_code(code [,lifespan])
Parameters:
| Parameter | Type | Description |
|---|---|---|
| code | string | The entered tfa to verify |
| lifespan | string |  [Optional]If, supplied, indicates the maximum lifespan (age) of the TFA in seconds. default is one hour(3600) |
Returned Value:
| Type | Description |
|---|---|
| boolean | true if the code verifies, false otherwise |
Examples
code = prompt("Authorization code?")
verified = verify_tfa_code(code)
if (!verified) {
abort("You are not authorized!")
}