public function settings() { $user = Session::read('default'); if ($user == "") { return $this->redirect('wallet::login'); } $wallet = Users::find("first", array("conditions" => array("walletid" => $user['walletid']))); $details = Details::find("first", array("conditions" => array("walletid" => $user['walletid']))); $greencoinAddress = $wallet['greencoinAddress'][0]; $address = Addresses::find("first", array("conditions" => array("a_id" => $greencoinAddress))); //$txid = "315965f1702a9bc0f5dede3f8bb81e8497e004789965452988d136b16391b8a5"; $balance = $address['balance'] / 100000000; $sent = $address['sent'] / 100000000; $receive = $address['receive'] / 100000000; if ($this->request->data) { if (stristr($_SERVER['HTTP_REFERER'], COMPANY_URL) === FALSE) { return $this->redirect('/wallet/login'); exit; } $data = array('alert.email.signin' => (bool) $this->request->data['alert_email_signin'], 'alert.email.receive' => (bool) $this->request->data['alert_email_receive'], 'alert.email.send' => (bool) $this->request->data['alert_email_send'], 'alert.phone.signin' => (bool) $this->request->data['alert_phone_signin'], 'alert.phone.receive' => (bool) $this->request->data['alert_phone_receive'], 'alert.phone.send' => (bool) $this->request->data['alert_phone_send'], 'password.send.email' => (bool) $this->request->data['password_send_email'], 'password.send.phone' => (bool) $this->request->data['password_send_phone']); $conditions = array("walletid" => $user['walletid']); $save = Details::update($data, $conditions); } $details = Details::find("first", array("conditions" => array("walletid" => $user['walletid']))); $ga = new GoogleAuthenticator(); $secret = $details['secret']; $qrCodeUrl = $ga->getQRCodeGoogleUrl(COMPANY_URL, $secret); return compact('greencoinAddress', 'wallet', 'balance', 'sent', 'receive', 'user', 'details', 'qrCodeUrl'); }
public function ga() { $ga = new GoogleAuthenticator(); $secret = $ga->createSecret(64); $secret = 'X6SWH7LNHWG3MBGNTWMJ53VPQ7IYWI6YSDYRZ6XYXWYS5KWZ4JFG7J6TM2P77AKX'; echo "Secret is: " . $secret . "\n\n"; $qrCodeUrl = $ga->getQRCodeGoogleUrl("ABCD", $secret); echo "Google Charts URL for the QR-Code: " . $qrCodeUrl . "\n\n"; $oneCode = $ga->getCode($secret); echo "Checking Code '{$oneCode}' and Secret '{$secret}':\n"; $checkResult = $ga->verifyCode($secret, $oneCode, 2); // 2 = 2*30sec clock tolerance if ($checkResult) { echo 'OK'; } else { echo 'FAILED'; } }