diff --git a/src/Auth/ConnectUserIdentity.php b/src/Auth/ConnectUserIdentity.php index 7148ee8..ae65b4f 100644 --- a/src/Auth/ConnectUserIdentity.php +++ b/src/Auth/ConnectUserIdentity.php @@ -91,7 +91,7 @@ protected function createIdentity($user, $provider, $oauthUser) 'token'=> IdentityCrypt::encryptString($oauthUser->token), 'refresh_token'=> IdentityCrypt::encryptString($oauthUser->refreshToken), 'expires_at'=> $oauthUser->expiresIn ? now()->addSeconds($oauthUser->expiresIn) : null, - 'registration' => true, + 'registration' => false, ] ); } diff --git a/tests/Unit/ConnectControllerTest.php b/tests/Unit/ConnectControllerTest.php index 9e9e4d1..358f033 100644 --- a/tests/Unit/ConnectControllerTest.php +++ b/tests/Unit/ConnectControllerTest.php @@ -103,6 +103,7 @@ public function test_connect_creates_identity() $this->assertEquals(Carbon::create(2020, 11, 12, 10, 21), $updatedIdentity->expires_at); $this->assertEquals('T2', IdentityCrypt::decryptString($updatedIdentity->token)); $this->assertEquals('RT2', IdentityCrypt::decryptString($updatedIdentity->refresh_token)); + $this->assertFalse($updatedIdentity->registration); } public function test_connect_updates_existing_identity() diff --git a/tests/Unit/RegistrationControllerTest.php b/tests/Unit/RegistrationControllerTest.php index c6021a9..94137c9 100644 --- a/tests/Unit/RegistrationControllerTest.php +++ b/tests/Unit/RegistrationControllerTest.php @@ -72,6 +72,7 @@ public function test_user_can_be_registered() $this->assertEquals(IdentityCrypt::hash('U1'), $firstIdentity->provider_id); $this->assertEquals('gitlab', $firstIdentity->provider); $this->assertNotNull($firstIdentity->token); + $this->assertTrue($firstIdentity->registration); } public function test_user_cannot_register_twice()