-
-
Notifications
You must be signed in to change notification settings - Fork 66
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5fca3f2
commit 292c068
Showing
30 changed files
with
760 additions
and
142 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<?php | ||
|
||
namespace JoelButcher\Socialstream\Contracts; | ||
|
||
interface OAuthLoginFailedResponse extends SocialstreamResponse | ||
{ | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<?php | ||
|
||
namespace JoelButcher\Socialstream\Contracts; | ||
|
||
interface OAuthLoginResponse extends SocialstreamResponse | ||
{ | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<?php | ||
|
||
namespace JoelButcher\Socialstream\Contracts; | ||
|
||
interface OAuthProviderLinkFailedResponse extends SocialstreamResponse | ||
{ | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<?php | ||
|
||
namespace JoelButcher\Socialstream\Contracts; | ||
|
||
interface OAuthProviderLinkedResponse extends SocialstreamResponse | ||
{ | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<?php | ||
|
||
namespace JoelButcher\Socialstream\Contracts; | ||
|
||
interface OAuthRegisterFailedResponse extends SocialstreamResponse | ||
{ | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<?php | ||
|
||
namespace JoelButcher\Socialstream\Contracts; | ||
|
||
interface OAuthRegisterResponse extends SocialstreamResponse | ||
{ | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<?php | ||
|
||
namespace JoelButcher\Socialstream\Contracts; | ||
|
||
use Illuminate\Contracts\Support\Responsable; | ||
|
||
interface SocialstreamResponse extends Responsable | ||
{ | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?php | ||
|
||
namespace JoelButcher\Socialstream\Events; | ||
|
||
use Illuminate\Broadcasting\InteractsWithSockets; | ||
use Illuminate\Foundation\Events\Dispatchable; | ||
use Illuminate\Queue\SerializesModels; | ||
use Laravel\Socialite\Contracts\User as ProviderUser; | ||
|
||
class NewOAuthRegistration | ||
{ | ||
use Dispatchable, InteractsWithSockets, SerializesModels; | ||
|
||
/** | ||
* Create a new event instance. | ||
*/ | ||
public function __construct( | ||
public mixed $user, | ||
public string $provider, | ||
public ProviderUser $providerAccount, | ||
) { | ||
// | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<?php | ||
|
||
namespace JoelButcher\Socialstream\Events; | ||
|
||
use Illuminate\Broadcasting\InteractsWithSockets; | ||
use Illuminate\Foundation\Events\Dispatchable; | ||
use Illuminate\Queue\SerializesModels; | ||
use Laravel\Socialite\Contracts\User as ProviderUser; | ||
|
||
class OAuthLogin | ||
{ | ||
use Dispatchable, InteractsWithSockets, SerializesModels; | ||
|
||
/** | ||
* Create a new event instance. | ||
*/ | ||
public function __construct( | ||
public mixed $user, | ||
public string $provider, | ||
public mixed $connectedAccount, | ||
public ProviderUser $providerAccount, | ||
) { | ||
// | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<?php | ||
|
||
namespace JoelButcher\Socialstream\Events; | ||
|
||
use Illuminate\Broadcasting\InteractsWithSockets; | ||
use Illuminate\Foundation\Events\Dispatchable; | ||
use Illuminate\Queue\SerializesModels; | ||
use Laravel\Socialite\Contracts\User as ProviderUser; | ||
|
||
class OAuthLoginFailed | ||
{ | ||
use Dispatchable, InteractsWithSockets, SerializesModels; | ||
|
||
/** | ||
* Create a new event instance. | ||
*/ | ||
public function __construct( | ||
public string $provider, | ||
public ProviderUser $providerAccount, | ||
) { | ||
// | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<?php | ||
|
||
namespace JoelButcher\Socialstream\Events; | ||
|
||
use Illuminate\Broadcasting\InteractsWithSockets; | ||
use Illuminate\Foundation\Events\Dispatchable; | ||
use Illuminate\Queue\SerializesModels; | ||
use Laravel\Socialite\Contracts\User as ProviderUser; | ||
|
||
class OAuthProviderLinkFailed | ||
{ | ||
use Dispatchable, InteractsWithSockets, SerializesModels; | ||
|
||
/** | ||
* Create a new event instance. | ||
*/ | ||
public function __construct( | ||
public mixed $user, | ||
public string $provider, | ||
public mixed $connectedAccount, | ||
public ProviderUser $providerAccount, | ||
) { | ||
// | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<?php | ||
|
||
namespace JoelButcher\Socialstream\Events; | ||
|
||
use Illuminate\Broadcasting\InteractsWithSockets; | ||
use Illuminate\Foundation\Events\Dispatchable; | ||
use Illuminate\Queue\SerializesModels; | ||
use Laravel\Socialite\Contracts\User as ProviderUser; | ||
|
||
class OAuthProviderLinked | ||
{ | ||
use Dispatchable, InteractsWithSockets, SerializesModels; | ||
|
||
/** | ||
* Create a new event instance. | ||
*/ | ||
public function __construct( | ||
public mixed $user, | ||
public string $provider, | ||
public mixed $connectedAccount, | ||
public ProviderUser $providerAccount, | ||
) { | ||
// | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?php | ||
|
||
namespace JoelButcher\Socialstream\Events; | ||
|
||
use Illuminate\Broadcasting\InteractsWithSockets; | ||
use Illuminate\Foundation\Events\Dispatchable; | ||
use Illuminate\Queue\SerializesModels; | ||
use Laravel\Socialite\Contracts\User as ProviderUser; | ||
|
||
class OAuthRegistrationFailed | ||
{ | ||
use Dispatchable, InteractsWithSockets, SerializesModels; | ||
|
||
/** | ||
* Create a new event instance. | ||
*/ | ||
public function __construct( | ||
public string $provider, | ||
public mixed $connectedAccount, | ||
public ProviderUser $providerAccount, | ||
) { | ||
// | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<?php | ||
|
||
namespace JoelButcher\Socialstream\Http\Responses; | ||
|
||
use App\Providers\RouteServiceProvider; | ||
use Illuminate\Http\RedirectResponse; | ||
use Illuminate\Support\Facades\Route; | ||
use JoelButcher\Socialstream\Concerns\InteractsWithComposer; | ||
use JoelButcher\Socialstream\Contracts\OAuthLoginResponse as LoginResponseContract; | ||
use JoelButcher\Socialstream\Socialstream; | ||
use Laravel\Fortify\Contracts\LoginResponse as FortifyLoginResponse; | ||
|
||
class OAuthLoginResponse implements LoginResponseContract | ||
{ | ||
use InteractsWithComposer; | ||
|
||
public function toResponse($request): RedirectResponse | ||
{ | ||
return Socialstream::redirects('login') | ||
? redirect()->intended(Socialstream::redirects('login')) | ||
: $this->defaultResponse(); | ||
} | ||
|
||
private function defaultResponse(): RedirectResponse|FortifyLoginResponse | ||
{ | ||
$previousUrl = session()->pull('socialstream.previous_url'); | ||
|
||
return match (true) { | ||
Route::has('filament.auth.login') && $previousUrl === route('filament.auth.login') => redirect() | ||
->route('admin'), | ||
$this->hasComposerPackage('laravel/breeze') => redirect() | ||
->route('dashboard'), | ||
$this->hasComposerPackage('laravel/jetstream') => app(FortifyLoginResponse::class), | ||
default => redirect() | ||
->to(RouteServiceProvider::HOME), | ||
}; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<?php | ||
|
||
namespace JoelButcher\Socialstream\Http\Responses; | ||
|
||
use Illuminate\Http\RedirectResponse; | ||
use Illuminate\Support\Facades\Route; | ||
use JoelButcher\Socialstream\Concerns\InteractsWithComposer; | ||
use JoelButcher\Socialstream\Contracts\OAuthLoginFailedResponse as OAuthLoginFailedResponseContract; | ||
use JoelButcher\Socialstream\Socialstream; | ||
|
||
class OAuthOAuthLoginFailedResponse implements OAuthLoginFailedResponseContract | ||
{ | ||
use InteractsWithComposer; | ||
|
||
public function toResponse($request): RedirectResponse | ||
{ | ||
return Socialstream::redirects('login-failed') | ||
? redirect()->intended(Socialstream::redirects('login-failed')) | ||
: $this->defaultResponse(); | ||
} | ||
|
||
private function defaultResponse(): RedirectResponse | ||
{ | ||
$previousUrl = session()->pull('socialstream.previous_url'); | ||
|
||
return redirect()->to(match (true) { | ||
Route::has('filament.auth.login') && $previousUrl === route('filament.auth.login') => 'filament.auth.login', | ||
Route::has('login') && $previousUrl === route('login') => 'login', | ||
Route::has('register') && $previousUrl === route('register') => 'register', | ||
default => 'login', | ||
}); | ||
} | ||
} |
Oops, something went wrong.