PHPGangsta / GoogleAuthenticator

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

one suggestion function getQRCodeGoogleUrl #12

Closed lyragosa closed 8 years ago

lyragosa commented 10 years ago

im lazy to submit code so i just write this issue. sorry for it.

That is the modify


    public function getQRCodeGoogleUrl($name, $secret, $title) {
        $urlencoded = urlencode('otpauth://totp/'.$name.'?secret='.$secret.'&issuer='.$title);
        return 'https://chart.googleapis.com/chart?chs=200x200&chld=M|0&cht=qr&chl='.$urlencoded.'';
    }

i add $title parameter, and use the key 'issuer=' . this parameter make the phone app show your website name in the top of the random code instead of in the bottom.

RobThree commented 9 years ago

See https://github.com/PHPGangsta/GoogleAuthenticator/pull/15; you need to correctly encode the values before encoding the entire url as well.

PHPGangsta commented 8 years ago

The $title / issuer parameter has been added in March 2015 by @yanniks: https://github.com/PHPGangsta/GoogleAuthenticator/blob/022046934a85217739b4e7610a37fcc8ffdf986e/PHPGangsta/GoogleAuthenticator.php#L102