RobThree / TwoFactorAuth

PHP library for Two Factor Authentication (TFA / 2FA)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Demo Always fails.

toddmcbrearty opened this issue Β· comments

commented

I've copied the demo into a laravel 5.1 view.
Every time i load the page i get this line

When aforementioned code (893875) was entered, the result would be: FAIL

Obviously each time i refresh the code changes but it still fails. Only change i made in the demo was to remove

require_once 'loader.php';
Loader::register('../lib','RobThree\\Auth');

Since laravel will load the package.

commented

I believe i found the problem.
In the demo you have

($tfa->verifyCode($secret, $code) === true)

verifyCode function returns 0 or 1 so that would obviously fail is it's not exactly equal to true.
You can either change === to == or i think it's better to return verifyCode as a bool

return (bool) result

Was just looking into it; verifyCode should return a bool. Will fix in a few minutes.

commented

great! thanks.

commented

if it's easier for you i can do a pull request

e837caa 😁

I've also created a new release.

Thanks for reporting it! πŸ‘

Hi, this got me confused this morning, luckly I saw this issue... I installed the package from composer (composer require robthree/twofactorauth) and it installed version 1.1, I tried telling composer to install version 1.2(which fixes this issue), with composer require robthree/twofactorauth:1.2 but composer stated that it coulnd't find any versione with that The requested package robthree/twofactorauth 1.2 could not be found.. I can't see what I'm doing wrong so maybe there's some sort of problem with the release...

Whoops... forgot to update composer.json. I have created a new release 1.3 which should work (probably should've been a minor 1.2.1 or something but what the hell... 😜 )

yep, fixed, thank you...

πŸ‘