feat: menric

This commit is contained in:
hashbro
2026-09-06 03:55:24 +08:00
parent f94def7c1f
commit d4c096ed4a
50 changed files with 1698 additions and 148 deletions
+2 -3
View File
@@ -2,7 +2,6 @@
namespace App\Services;
use App\Models\Admin;
use BaconQrCode\Renderer\Image\SvgImageBackEnd;
use BaconQrCode\Renderer\ImageRenderer;
use BaconQrCode\Renderer\RendererStyle\RendererStyle;
@@ -33,11 +32,11 @@ class AdminGoogle2fa
return (bool) $this->google2fa->verifyKey($secret, $code);
}
public function otpAuthUrl(Admin $admin, string $secret): string
public function otpAuthUrl(string $username, string $secret, string $label = 'admin'): string
{
$issuer = (string) config('app.name', 'Coruna Lab');
return $this->google2fa->getQRCodeUrl($issuer, $admin->username.'@admin', $secret);
return $this->google2fa->getQRCodeUrl($issuer, $username.'@'.$label, $secret);
}
public function qrSvg(string $otpAuthUrl, int $size = 200): string