diff --git a/lib/TwoFactorAuth.php b/lib/TwoFactorAuth.php index 7bc067d..b0d4ab4 100644 --- a/lib/TwoFactorAuth.php +++ b/lib/TwoFactorAuth.php @@ -13,6 +13,7 @@ class TwoFactorAuth private $period; private $digits; private $issuer; + private $image; private $qrcodeprovider = null; private $rngprovider = null; private $timeprovider = null; @@ -179,7 +180,8 @@ public function getQRText($label, $secret) . '&issuer=' . rawurlencode($this->issuer) . '&period=' . intval($this->period) . '&algorithm=' . rawurlencode(strtoupper($this->algorithm)) - . '&digits=' . intval($this->digits); + . '&digits=' . intval($this->digits) + . ($this->image != '' ? '&image=' . rawurlencode($this->image) : ''); } private function base32Decode($value) @@ -253,4 +255,17 @@ public function getTimeProvider() } return $this->timeprovider; } + + /** + * Set the image url used by FreeOTP + */ + public function setImage($image) + { + $ext = explode(".", $image); + //Image must be PNG + if (strtolower(end($ext)) == "png") { + $this->image = $image; + } + } + } \ No newline at end of file