Skip to content

Commit 8fb4930

Browse files
authored
Ensure connection do not set registration flag (#6)
1 parent fab584a commit 8fb4930

File tree

3 files changed

+3
-1
lines changed

3 files changed

+3
-1
lines changed

src/Auth/ConnectUserIdentity.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ protected function createIdentity($user, $provider, $oauthUser)
9191
'token'=> IdentityCrypt::encryptString($oauthUser->token),
9292
'refresh_token'=> IdentityCrypt::encryptString($oauthUser->refreshToken),
9393
'expires_at'=> $oauthUser->expiresIn ? now()->addSeconds($oauthUser->expiresIn) : null,
94-
'registration' => true,
94+
'registration' => false,
9595
]
9696
);
9797
}

tests/Unit/ConnectControllerTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ public function test_connect_creates_identity()
103103
$this->assertEquals(Carbon::create(2020, 11, 12, 10, 21), $updatedIdentity->expires_at);
104104
$this->assertEquals('T2', IdentityCrypt::decryptString($updatedIdentity->token));
105105
$this->assertEquals('RT2', IdentityCrypt::decryptString($updatedIdentity->refresh_token));
106+
$this->assertFalse($updatedIdentity->registration);
106107
}
107108

108109
public function test_connect_updates_existing_identity()

tests/Unit/RegistrationControllerTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ public function test_user_can_be_registered()
7272
$this->assertEquals(IdentityCrypt::hash('U1'), $firstIdentity->provider_id);
7373
$this->assertEquals('gitlab', $firstIdentity->provider);
7474
$this->assertNotNull($firstIdentity->token);
75+
$this->assertTrue($firstIdentity->registration);
7576
}
7677

7778
public function test_user_cannot_register_twice()

0 commit comments

Comments
 (0)