Skip to content

Commit a1e1da8

Browse files
committed
Fix unable to import google authenticator
1 parent 233496a commit a1e1da8

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

app/Factories/MigratorFactory.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public function create(string $migrationPayload) : Migrator
2929
return App::make(AegisMigrator::class);
3030
} elseif ($this->is2FASv2($migrationPayload)) {
3131
return App::make(TwoFASMigrator::class);
32-
} elseif ($this->isGoogleAuth($migrationPayload)) {
32+
} elseif (self::isGoogleAuth($migrationPayload)) {
3333
return App::make(GoogleAuthMigrator::class);
3434
} elseif ($this->isPlainText($migrationPayload)) {
3535
return App::make(PlainTextMigrator::class);
@@ -43,7 +43,7 @@ public function create(string $migrationPayload) : Migrator
4343
*
4444
* @param string $migrationPayload The payload to analyse
4545
*/
46-
private function isGoogleAuth(string $migrationPayload) : bool
46+
public static function isGoogleAuth(string $migrationPayload) : bool
4747
{
4848
// - Google Auth migration URI : a string starting with otpauth-migration://offline?data= on a single line
4949

app/Services/QrCodeService.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
namespace App\Services;
44

5+
use App\Factories\MigratorFactory;
56
use chillerlan\QRCode\QRCode;
67
use chillerlan\QRCode\QROptions;
78
use Illuminate\Support\Facades\Log;
@@ -68,7 +69,9 @@ public static function decode(\Illuminate\Http\UploadedFile $file)
6869
}
6970
}
7071

71-
$data = urldecode($text);
72+
if (!MigratorFactory::isGoogleAuth($text)) {
73+
$data = urldecode($text);
74+
}
7275

7376
Log::info('QR code decoded');
7477

0 commit comments

Comments
 (0)