Skip to content

Commit

Permalink
fix: fix socialite integration (monicahq/chandler#554)
Browse files Browse the repository at this point in the history
  • Loading branch information
asbiin authored May 27, 2023
1 parent 039f478 commit 2fddbe1
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ public static function postsInYear(Journal $journal, int $year, User $user): Col
'excerpt' => $post->excerpt,
'written_at_day' => Str::upper(DateHelper::formatShortDay($post->written_at)),
'written_at_day_number' => DateHelper::formatDayNumber($post->written_at),
'photo' => $post?->files?->first() ? [
'photo' => optional(optional($post)->files)->first() ? [
'id' => $post->files->first()->id,
'url' => [
'show' => 'https://ucarecdn.com/'.$post->files->first()->uuid.'/-/scale_crop/75x75/smart/-/format/auto/-/quality/smart_retina/',
Expand Down
2 changes: 1 addition & 1 deletion app/Http/Controllers/Auth/AcceptInvitationController.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public function store(Request $request)
Auth::login($user);

return response()->json([
'data' => route('vault.index'),
'data' => route('home'),
], 200);
}
}
2 changes: 1 addition & 1 deletion app/Http/Controllers/Auth/SocialiteCallbackController.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public function callback(Request $request, string $driver): RedirectResponse
$this->checkForErrors($request, $driver);

return $this->loginPipeline($request)->then(function (/*$request*/) {
return Redirect::intended(route('vault.index'));
return Redirect::intended(route('home'));
});
} catch (ValidationException $e) {
throw $e->redirectTo(Redirect::intended(route('home'))->getTargetUrl());
Expand Down
23 changes: 16 additions & 7 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public function up()
$table->string('driver', 50);
$table->char('format', 6);
$table->string('email', 1024)->nullable();
$table->string('token', 2048);
$table->string('token', 4096);
$table->string('token_secret', 2048)->nullable();
$table->string('refresh_token', 2048)->nullable();
$table->unsignedBigInteger('expires_in')->nullable();
Expand Down
2 changes: 1 addition & 1 deletion routes/web.php
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@
return Redirect::route('login');
}
if (($vaults = Auth::user()->vaults)->count() === 1) {
return Redirect::route('vault.show', $vaults->first());
return Redirect::intended(route('vault.show', $vaults->first()));
}

return Redirect::intended(RouteServiceProvider::HOME);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ public function it_get_user_created(): void

$response = $this->get('/auth/test/callback?code=thecode&state=state');
$response->assertStatus(302);
$response->assertRedirect(config('app.url').'/vaults');
$response->assertRedirect(config('app.url'));

$mock->assertResponses();

Expand Down Expand Up @@ -123,7 +123,7 @@ public function it_associate_token_to_logged_user(): void

$response = $this->get('/auth/test/callback?code=thecode&state=state');
$response->assertStatus(302);
$response->assertRedirect(config('app.url').'/vaults');
$response->assertRedirect(config('app.url'));

$mock->assertResponses();

Expand Down

0 comments on commit 2fddbe1

Please sign in to comment.