From 03ba1d020c61fe4f6659f4fd0620c07623d58e48 Mon Sep 17 00:00:00 2001 From: Joel Butcher Date: Fri, 29 Jan 2021 20:33:04 +0000 Subject: [PATCH 1/3] wip --- src/Features.php | 20 ++++++++++++++++++++ src/Socialstream.php | 10 ++++++++++ 2 files changed, 30 insertions(+) diff --git a/src/Features.php b/src/Features.php index 9fa2b31f..5a926787 100644 --- a/src/Features.php +++ b/src/Features.php @@ -26,6 +26,16 @@ public static function createsAccountsOnFirstLogin() return static::enabled(static::createAccountOnFirstLogin()); } + /** + * Determine if the application should remember the users session om login. + * + * @return bool + */ + public static function shouldRememberSession() + { + return static::enabled(static::rememberSession()); + } + /** * Enable the create account on first login feature. * @@ -35,4 +45,14 @@ public static function createAccountOnFirstLogin() { return 'create-account-on-first-login'; } + + /** + * Enable the remember session feature for logging in. + * + * @return string + */ + public static function rememberSession() + { + return 'remember-session'; + } } diff --git a/src/Socialstream.php b/src/Socialstream.php index 5fa2144d..a25373ba 100644 --- a/src/Socialstream.php +++ b/src/Socialstream.php @@ -54,6 +54,16 @@ public static function hasSupportFor(string $service) return in_array($service, config('socialstream.providers')); } + /** + * Determine if the application should remember the users session om login. + * + * @return bool + */ + public static function shouldRememberSession() + { + return Features::shouldRememberSession(); + } + /** * Find a connected account instance fot a given provider and provider ID. * From 5970d1b85405a99aea5d27a3cc36d3743ebc5e70 Mon Sep 17 00:00:00 2001 From: Joel Butcher Date: Fri, 29 Jan 2021 20:33:16 +0000 Subject: [PATCH 2/3] wip --- config/socialstream.php | 12 ------------ src/Http/Controllers/OAuthController.php | 6 +++--- 2 files changed, 3 insertions(+), 15 deletions(-) diff --git a/config/socialstream.php b/config/socialstream.php index 96806813..b0fd9757 100644 --- a/config/socialstream.php +++ b/config/socialstream.php @@ -20,18 +20,6 @@ 'show' => env('SOCIALSTREAM_SHOW', true), - /* - |-------------------------------------------------------------------------- - | Socialstream Remember Session - |-------------------------------------------------------------------------- - | - | This value is used to determine if a session created by socialstream - | uses the "remember me" login parameter. - | - */ - - 'remember' => env('SOCIALSTREAM_REMEMBER', false), - /* |-------------------------------------------------------------------------- | Socialstream Route Middleware diff --git a/src/Http/Controllers/OAuthController.php b/src/Http/Controllers/OAuthController.php index 4ee30f04..db42054d 100644 --- a/src/Http/Controllers/OAuthController.php +++ b/src/Http/Controllers/OAuthController.php @@ -144,7 +144,7 @@ public function handleProviderCallback(Request $request, string $provider) $user = $this->createsUser->create($provider, $providerAccount); - $this->guard->login($user, config('socialstream.remember')); + $this->guard->login($user, Socialstream::shouldRememberSession()); return redirect(config('fortify.home')); } @@ -164,12 +164,12 @@ public function handleProviderCallback(Request $request, string $provider) $user = $this->createsUser->create($provider, $providerAccount); - $this->guard->login($user, config('socialstream.remember')); + $this->guard->login($user, Socialstream::shouldRememberSession()); return redirect(config('fortify.home')); } - $this->guard->login($account->user, config('socialstream.remember')); + $this->guard->login($account->user, Socialstream::shouldRememberSession()); $account->user->forceFill([ 'current_connected_account_id' => $account->id, From f015fe51c782eacb68e82efb142f55ecf1a8e4d2 Mon Sep 17 00:00:00 2001 From: Joel Butcher Date: Fri, 29 Jan 2021 20:33:33 +0000 Subject: [PATCH 3/3] Apply fixes from StyleCI --- src/Features.php | 4 ++-- src/Socialstream.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Features.php b/src/Features.php index 5a926787..ea776baf 100644 --- a/src/Features.php +++ b/src/Features.php @@ -28,7 +28,7 @@ public static function createsAccountsOnFirstLogin() /** * Determine if the application should remember the users session om login. - * + * * @return bool */ public static function shouldRememberSession() @@ -48,7 +48,7 @@ public static function createAccountOnFirstLogin() /** * Enable the remember session feature for logging in. - * + * * @return string */ public static function rememberSession() diff --git a/src/Socialstream.php b/src/Socialstream.php index a25373ba..836f0eaa 100644 --- a/src/Socialstream.php +++ b/src/Socialstream.php @@ -56,7 +56,7 @@ public static function hasSupportFor(string $service) /** * Determine if the application should remember the users session om login. - * + * * @return bool */ public static function shouldRememberSession()