Update TwoFactor.php

安装的依赖endroid/qrcode已经弃用
请使用composer require endroid/qr-code
pull/18/head
LinEvil 8 years ago committed by GitHub
parent 12f7f691eb
commit 31f1eb839f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -20,15 +20,16 @@ class TwoFactor extends Model{
public function qrcodeRender(){ public function qrcodeRender(){
ob_end_clean(); ob_end_clean();
header("content-type: image/png");
$this->secretKey = $this->ga->createSecret(); $this->secretKey = $this->ga->createSecret();
$qrCode = new QrCode();
session("two_factor_enable",$this->secretKey); session("two_factor_enable",$this->secretKey);
$qrCode->setText(urldecode($this->ga->getQRCodeGoogleUrl(Option::getValue("siteName"), $this->secretKey))) $qrCode = new QrCode(urldecode($this->ga->getQRCodeGoogleUrl(Option::getValue("siteName"), $this->secretKey)));
->setPadding(5) $qrCode->setSize(165);
->render(); $qrCode->setMargin(0);
header('Content-Type: '.$qrCode->getContentType());
echo $qrCode->writeString();
} }
public function confirmCode($key,$code){ public function confirmCode($key,$code){
$this->secretKey = $key; $this->secretKey = $key;
if(empty($code)){ if(empty($code)){

Loading…
Cancel
Save