修复二步验证二维码错误

pull/33/head
HFO4 8 years ago
parent 937dfc77fd
commit 6361d4bd2e

@ -18,16 +18,16 @@ class TwoFactor extends Model{
$this->ga = new PHPGangsta_GoogleAuthenticator(); $this->ga = new PHPGangsta_GoogleAuthenticator();
} }
public function qrcodeRender(){ public function qrcodeRender(){
ob_end_clean(); ob_end_clean();
$this->secretKey = $this->ga->createSecret(); $this->secretKey = $this->ga->createSecret();
session("two_factor_enable",$this->secretKey); session("two_factor_enable",$this->secretKey);
$qrCode = new QrCode(urldecode($this->ga->getQRCodeGoogleUrl(Option::getValue("siteName"), $this->secretKey))); $qrCode = new QrCode(urldecode(str_replace("https://chart.googleapis.com/chart?chs=200x200&chld=M|0&cht=qr&chl=","",$this->ga->getQRCodeGoogleUrl(Option::getValue("siteName"), $this->secretKey))));
$qrCode->setSize(165); $qrCode->setSize(165);
$qrCode->setMargin(0); $qrCode->setMargin(0);
header('Content-Type: '.$qrCode->getContentType()); header('Content-Type: '.$qrCode->getContentType());
echo $qrCode->writeString(); echo $qrCode->writeString();
} }
public function confirmCode($key,$code){ public function confirmCode($key,$code){

1436
composer.lock generated

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save