🆙 Add cms i using 🆙

This commit is contained in:
Remco
2025-11-25 22:42:56 +01:00
parent 94704e0925
commit d44196149e
35591 changed files with 3601123 additions and 0 deletions
File diff suppressed because one or more lines are too long
@@ -0,0 +1,89 @@
<?php
namespace PragmaRX\Google2FAQRCode\Tests;
use PragmaRX\Google2FAQRCode\QRCode\Bacon;
use PragmaRX\Google2FAQRCode\QRCode\Chillerlan;
use BaconQrCode\Renderer\Image\ImagickImageBackEnd;
use BaconQrCode\Renderer\Image\Png;
use PHPUnit\Framework\TestCase;
use PragmaRX\Google2FAQRCode\Google2FA;
use Zxing\QrReader;
use PragmaRX\Google2FAQRCode\Exceptions\MissingQrCodeServiceException;
class Google2FATest extends TestCase
{
const EMAIL = 'acr+pragmarx@antoniocarlosribeiro.com';
const OTP_URL = 'otpauth://totp/PragmaRX:acr+pragmarx@antoniocarlosribeiro.com?secret=ADUMJO5634NPDEKW&issuer=PragmaRX&algorithm=SHA1&digits=6&period=30';
public function setUp(): void
{
$this->google2fa = new Google2FA();
}
public function readQRCode($data)
{
[, $data] = explode(';', $data);
[, $data] = explode(',', $data);
return rawurldecode(
(new QrReader(
base64_decode($data),
QrReader::SOURCE_TYPE_BLOB
))->text()
);
}
public function testQrcodeServiceMissing()
{
$this->expectException(MissingQrCodeServiceException::class);
$this->google2fa->setQrcodeService(null);
$this->getQrCode();
}
public function testQrcodeInlineBacon()
{
if (!(new Bacon())->imagickIsAvailable()) {
$this->assertTrue(true);
return;
}
$this->google2fa->setQrcodeService(new Bacon());
$this->assertEquals(
static::OTP_URL,
$this->readQRCode($this->getQRCode())
);
$google2fa = new Google2FA(null, new Bacon(new \BaconQrCode\Renderer\Image\SvgImageBackEnd()));
$this->assertEquals(
static::OTP_URL,
$this->readQRCode($this->getQRCode())
);
}
public function testQrcodeInlineChillerlan()
{
$this->google2fa->setQrcodeService(new Chillerlan());
$this->assertStringStartsWith(
'data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMj',
$this->getQRCode()
);
}
public function getQrCode()
{
return $this->google2fa->getQRCodeInline(
'PragmaRX',
static::EMAIL,
Constants::SECRET
);
}
}
@@ -0,0 +1,42 @@
<?php
/*
|--------------------------------------------------------------------------
| Register The Composer Auto Loader
|--------------------------------------------------------------------------
|
| Composer provides a convenient, automatically generated class loader
| for our application. We just need to utilize it! We'll require it
| into the script here so that we do not have to worry about the
| loading of any our classes "manually". Feels great to relax.
|
*/
require __DIR__ . '/../vendor/autoload.php';
/*
|--------------------------------------------------------------------------
| Set The Default Timezone
|--------------------------------------------------------------------------
|
| Here we will set the default timezone for PHP. PHP is notoriously mean
| if the timezone is not explicitly set. This will be used by each of
| the PHP date and date-time functions throughout the application.
|
*/
date_default_timezone_set('UTC');
function d($args)
{
foreach ($args as $arg) {
var_dump($arg);
}
}
function dd()
{
d(func_get_args());
die();
}