PHPGangsta / GoogleAuthenticator

PHP class to generate and verify Google Authenticator 2-factor authentication
http://phpgangsta.de/4376
BSD 2-Clause "Simplified" License
2.23k stars 689 forks source link

Email verify #73

Closed MrZsemle closed 4 years ago

MrZsemle commented 4 years ago

Hi!

I would like to ask you how to create in the email verify code submissions. I would like to use the PHPMailer class for this. And the codes in the email would be valid for 5-10 minutes. How could this be done?

RSpeekenbrink commented 4 years ago

Generate a code via getCode() and verify the code with a discrepancy parameter passed to it. Discrepancy is the allowed time drift in 30 second units (8 means 4 minutes before or after). Since it's before or after the given timeslice you should save the timeslice somewhere and get that to validate against.

MrZsemle commented 4 years ago

Thank you!