Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F117841635
D4818.1775309176.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Authored By
Unknown
Size
2 KB
Referenced Files
None
Subscribers
None
D4818.1775309176.diff
View Options
diff --git a/src/app/Http/Controllers/API/V4/CompanionAppsController.php b/src/app/Http/Controllers/API/V4/CompanionAppsController.php
--- a/src/app/Http/Controllers/API/V4/CompanionAppsController.php
+++ b/src/app/Http/Controllers/API/V4/CompanionAppsController.php
@@ -254,15 +254,16 @@
$result->setPassportClient($client);
$result->save();
}
- $response['qrcode'] = self::generateQRCode(
- json_encode([
- "serverUrl" => Utils::serviceUrl('', $user->tenant_id),
- "clientIdentifier" => $client->id,
- "clientSecret" => $client->secret,
- "companionId" => $id,
- "username" => $user->email
- ])
- );
+
+ $response = [
+ 'serverUrl' => Utils::serviceUrl('', $user->tenant_id),
+ 'clientIdentifier' => $client->id,
+ 'clientSecret' => $client->secret,
+ 'companionId' => $id,
+ 'username' => $user->email,
+ ];
+
+ $response['qrcode'] = self::generateQRCode(json_encode($response));
return response()->json($response);
}
diff --git a/src/tests/Feature/Controller/CompanionAppsTest.php b/src/tests/Feature/Controller/CompanionAppsTest.php
--- a/src/tests/Feature/Controller/CompanionAppsTest.php
+++ b/src/tests/Feature/Controller/CompanionAppsTest.php
@@ -309,10 +309,15 @@
$response = $this->actingAs($user)->get("api/v4/companions/{$companionApp->id}/pairing");
$response->assertStatus(200);
- $companionApp->refresh();
- $this->assertTrue($companionApp->oauth_client_id != null);
-
$json = $response->json();
+ $client = $companionApp->fresh()->passportClient();
+
+ $this->assertTrue($client !== null);
+ $this->assertSame($user->email, $json['username']);
+ $this->assertSame($companionApp->id, $json['companionId']);
+ $this->assertSame($client->id, $json['clientIdentifier']); // TODO: This should be clientId
+ $this->assertSame($client->secret, $json['clientSecret']);
+ $this->assertSame(\App\Utils::serviceUrl('', $user->tenant_id), $json['serverUrl']);
$this->assertArrayHasKey('qrcode', $json);
$this->assertSame('data:image/svg+xml;base64,', substr($json['qrcode'], 0, 26));
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Apr 4, 1:26 PM (27 m, 37 s ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
18829642
Default Alt Text
D4818.1775309176.diff (2 KB)
Attached To
Mode
D4818: Send QR-code content also plain text
Attached
Detach File
Event Timeline