Company
Date Published
Author
Cristiano Betta
Word count
1983
Language
English
Hacker News points
None

Summary

This tutorial demonstrates how to add two-factor authentication to a Django site using the Vonage Verify API. The author creates a simple web app called "Pollstr" that uses this feature to secure its polls, allowing users to verify their phone numbers and prevent spam. The implementation involves adding a `TwoFactorMixin` to the views, which checks if the user is logged in and verified before proceeding. The mixin also redirects the user to a verification page where they can enter their phone number or confirm an existing one. Once the user confirms their code, the session is marked as verified, allowing them to view the poll without being redirected away. The tutorial showcases Vonage Verify's ease of use and resilience, with options for customizing the user experience further.