Skip to content

Commit e314c32

Browse files
authored
Merge pull request #487 from igophper/fix_google_migrate
Fixes #447: Unable to import google authenticator
2 parents a7683bc + a2c6aca commit e314c32

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

app/Factories/MigratorFactory.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public function create(string $migrationPayload) : Migrator
3030
return App::make(AegisMigrator::class);
3131
} elseif ($this->is2FASv2($migrationPayload)) {
3232
return App::make(TwoFASMigrator::class);
33-
} elseif ($this->isGoogleAuth($migrationPayload)) {
33+
} elseif (self::isGoogleAuth($migrationPayload)) {
3434
return App::make(GoogleAuthMigrator::class);
3535
} elseif ($this->isBitwardenJson($migrationPayload)) {
3636
return App::make(BitwardenMigrator::class);
@@ -46,7 +46,7 @@ public function create(string $migrationPayload) : Migrator
4646
*
4747
* @param string $migrationPayload The payload to analyse
4848
*/
49-
private function isGoogleAuth(string $migrationPayload) : bool
49+
public static function isGoogleAuth(string $migrationPayload) : bool
5050
{
5151
// - Google Auth migration URI : a string starting with otpauth-migration://offline?data= on a single line
5252

app/Services/QrCodeService.php

Lines changed: 5 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,10 @@ public static function decode(\Illuminate\Http\UploadedFile $file)
6869
}
6970
}
7071

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

7377
Log::info('QR code decoded');
7478

0 commit comments

Comments
 (0)