Skip to content

Commit

Permalink
feat: disable email verification after employee joins company (#858)
Browse files Browse the repository at this point in the history
  • Loading branch information
djaiss authored May 9, 2021
1 parent c46bce9 commit 7dd5b00
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
3 changes: 2 additions & 1 deletion app/Http/Controllers/Auth/UserInvitationController.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,8 @@ public function join(Request $request, string $invitationLink): JsonResponse
// email doesn't exist yet, create the account
$user = (new CreateAccount)->execute($requestInputs);

$user->sendEmailVerificationNotification();
$user->email_verified_at = Carbon::now();
$user->save();

/** @var \Illuminate\Contracts\Auth\StatefulGuard */
$guard = Auth::guard();
Expand Down
7 changes: 2 additions & 5 deletions tests/Unit/Controllers/Auth/UserInvitationControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,18 +35,15 @@ public function it_creates_a_user_invited(): void
$response->assertStatus(204);

$employee->refresh();

$this->assertNotEmpty($employee->invitation_used_at);

$this->assertDatabaseHas('users', [
'id' => $employee->user_id,
'email' => '[email protected]',
]);

$user = User::find($employee->user_id);

Notification::assertSentTo(
[$user],
VerifyEmail::class
);
}

/** @test */
Expand Down

0 comments on commit 7dd5b00

Please sign in to comment.