Hi,
Does anyone know if it would be possible to build in google authenticator when I inloggen.zelf decision on GoogleAuthenticator.php to calculate the code and also to give the qr code.
The attached code I posted "before login" event.
The code is working up to the HTML (that he does not carry out) passes directly through to the listing.
Can anyone help so that the HTML and the QR code shown in the log.
thank you
$rs = DB::Query("select * from geo_database_users where username ='$username'");
$data=$rs->fetchAssoc();
$email=$data["email"];
if ($data["google_auth_code"]=="")
{
require_once 'googleLib/GoogleAuthenticator.php';
$ga = new GoogleAuthenticator();
$secret = $ga->createSecret();
global $dal;
$tblUsers = $dal->Table("geo_database_users");
$tblUsers->Param["username"]=$username;
$tblUsers->Value['google_auth_code']= $secret ;
$tblUsers->Update();
}
else
{
$secret = $data["google_auth_code"];
}
require_once 'googleLib/GoogleAuthenticator.php';
$ga = new GoogleAuthenticator();
$qrCodeUrl = $ga->getQRCodeGoogleUrl($email, $secret,'Geo_Db');
echo $qrCodeUrl;
?>
<!DOCTYPE html>
<html>
<head>
<title>2-Step Verification using Google Authenticator</title>
<link rel="stylesheet" type="text/css" href="style.css" charset="utf-8" />
</head>
<body>
<div id="container">
<h1>2-Step Verification using Google Authenticator</h1>
<div id='device'>
<p>Enter the verification code generated by Google Authenticator app on your phone.</p>
<div id="img">
<img src='<?php echo $qrCodeUrl; ?>' />
</div>
<form method="post" >
<label>Enter Google Authenticator Code</label>
<input type="text" name="code" />
<input type="submit" class="button"/>
</form>
</div>
<div style="text-align:center">
<h3>Get Google Authenticator on your phone</h3>
<a href="https://itunes.apple.com/us/app/google-authenticator/id388497605?mt=8" target="_blank"><img class='app' src="images/iphone.png" /></a>
<a href="https://play.google.com/store/apps/details?id=com.google.android.apps.authenticator2&hl=en" target="_blank"><img class="app" src="images/android.png" /></a>
</div>
</div>
</body>
</html>
<?php
if($_POST['code'])
{
$code=$_POST['code'];
require_once 'googleLib/GoogleAuthenticator.php';
$ga = new GoogleAuthenticator();
$checkResult = $ga->verifyCode($secret, $code, 2); // 2 = 2*30sec clock tolerance
if ($checkResult)
{
$_SESSION['googleCode']=$code;
}
else
{
echo 'FAILED';
}
}
return true;