model('user/prefs');
$loader->helper('phpqrcode/qrlib');
$loader->helper('PHPGangsta_GoogleAuthenticator');
$p = new ModelUserPrefs();
if(isset($_GET['refresh'])) {
$GA = new PHPGangsta_GoogleAuthenticator();
$new_secret = $GA->createSecret();
$p->update_ga_secret($session->get('username'), $new_secret);
print "$new_secret " . $language->data['text_refresh_qr_code'] . "
\n";
exit;
}
else if(isset($_GET['toggle'])) {
$p->toggle_ga($session->get('username'), $_GET['toggle']);
}
$ga = $p->get_ga_settings($session->get('username'));
QRcode::png($ga['ga_secret'], false, "L", 8, 2);
?>