|
1 | | -# Twilio |
| 1 | +# Twilio Verify |
2 | 2 |
|
3 | | -## Sample Registration page |
| 3 | +Twilio is a verification service that allows you to send a code to a user's phone or use a time-based one time password to verify their identity. You can find more information on Twilio at [https://www.twilio.com/](https://www.twilio.com/). This is not a free service, so you will need to sign up for a Twilio account. Each successful verification will cost you $0.05, so this is something to consider before implementing. |
| 4 | + |
| 5 | +## Phone Verification |
| 6 | + |
| 7 | +### Sample Registration page |
4 | 8 |
|
5 | 9 | ```html |
6 | 10 | <link |
|
66 | 70 | </script> |
67 | 71 | ``` |
68 | 72 |
|
69 | | -## Sample Activation Page (&twilioActivationResourceId) |
| 73 | +### Sample Activation Page (&twilioActivationResourceId) |
70 | 74 |
|
71 | 75 | ```html |
72 | 76 | [[!TwilioGetPhone]] |
@@ -108,3 +112,67 @@ Phone: [[!+twilio.phone]] |
108 | 112 | </div> |
109 | 113 | </form> |
110 | 114 | ``` |
| 115 | + |
| 116 | +## Time-based One Time Password |
| 117 | + |
| 118 | +### Sample Challenge Page |
| 119 | + |
| 120 | +Create a challenge page and set the system setting `twilio.totp_challenge_page` to the page ID. |
| 121 | + |
| 122 | +```html |
| 123 | +[[!FormIt? |
| 124 | + &hooks=`TwilioTOTPChallenge,TwilioVerify` |
| 125 | + &twilioRedirect=`4` // ID of the page to redirect to after verification |
| 126 | + &twilioFactorType=`totp` |
| 127 | + &validate=`code:required` |
| 128 | +]] |
| 129 | +<form method="post"> |
| 130 | + <label> |
| 131 | + Enter 2FA Code |
| 132 | + <input name="code" value="" /> |
| 133 | + </label> |
| 134 | + <button type="submit">Submit</button> |
| 135 | +</form> |
| 136 | +``` |
| 137 | + |
| 138 | +### Sample Create/Reset Token Page |
| 139 | + |
| 140 | +Create a page with the following content: |
| 141 | + |
| 142 | +```html |
| 143 | +[[TwilioTOTPCreate?twilioRedirect=`4`]] |
| 144 | +``` |
| 145 | + |
| 146 | +### Sample Profile Page |
| 147 | + |
| 148 | +```html |
| 149 | +[[!TwilioTOTPqr]] |
| 150 | + |
| 151 | +[[!+twilio.qr:ne=``:then=` |
| 152 | + <img src="[[!+twilio.qr]]" /> |
| 153 | + <p>Secret [[!+twilio.secret]]</p> |
| 154 | + [[!+twilio.status:is=`unverified`:then=` |
| 155 | + <p><a href="[[~5]]"><strong>Verify 2FA Code Before Next Login</strong></a></p> <!-- link to challenge page --> |
| 156 | + `:else=``]] |
| 157 | + <p><a href="[[~6]]">Refresh 2FA</a><br /> <!-- link to create / refresh page --> |
| 158 | + <a href="[[~6?status=`disable_totp`]]">Disable 2FA</a></p> |
| 159 | +`:else=` |
| 160 | + <a href="[[~6]]">Enable 2FA</a> |
| 161 | +`]] |
| 162 | +``` |
| 163 | + |
| 164 | +## System Settings |
| 165 | + |
| 166 | +| key | description | |
| 167 | +| --- |------------------------------------------------------------------------------------------------------------| |
| 168 | +| twilio.account_sid | Twilio Account SID - Found under Account Info here https://console.twilio.com/ | |
| 169 | +| twilio.account_token | Twilio Auth Token - Found under Account Info here https://console.twilio.com/ | |
| 170 | +| twilio.service_id | Twilio Service ID - Found under Services Page here https://console.twilio.com/us1/develop/verify/services | |
| 171 | +| twilio.totp_enforce | Enforce 2FA for all users | |
| 172 | +| twilio.totp_email_on_login | Email a code to the user when they login | |
| 173 | +| twilio.totp_challenge_page | Page ID of the challenge page | |
| 174 | + |
| 175 | +## Manager Page |
| 176 | + |
| 177 | +Twilio 2FA Verification can be enabled in the manager login as well. You can view the status of Twilio 2FA for each user in the menu under |
| 178 | +"Extras -> User Authentication" |
0 commit comments