Skip to content

Commit

Permalink
feat: apply config setting
Browse files Browse the repository at this point in the history
  • Loading branch information
warcooft authored Sep 10, 2024
1 parent 2b1672e commit 8f25ed3
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/Controllers/OAuthController.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public function redirectOAuth(string $oauthName): RedirectResponse
return redirect()->to(config('Auth')->loginRedirect());
}

if (config('ShieldOAuthConfig')->oauthConfigs[$oauthName]['allow_login'] === false) {
if (setting('ShieldOAuthConfig.oauthConfigs')[$oauthName]['allow_login'] === false) {

Check failure on line 35 in src/Controllers/OAuthController.php

View workflow job for this annotation

GitHub Actions / PHP 7.4 Static Analysis

Function setting not found.

Check failure on line 35 in src/Controllers/OAuthController.php

View workflow job for this annotation

GitHub Actions / PHP 8.0 Static Analysis

Function setting not found.

Check failure on line 35 in src/Controllers/OAuthController.php

View workflow job for this annotation

GitHub Actions / PHP 8.1 Static Analysis

Function setting not found.
$errorText = 'ShieldOAuthLang.' . ucfirst($oauthName) . '.not_allow';

return redirect()->to(config('Auth')->logoutRedirect())->with('error', lang($errorText));
Expand Down Expand Up @@ -93,7 +93,7 @@ public function callBack(): RedirectResponse
$userid = $this->syncingUserInfo($find, $updateFields);
} else {
// Check config setting first to see if it can register automatically or not
if (config('ShieldOAuthConfig')->oauthConfigs[$oauthName]['allow_register'] === false) {
if (setting('ShieldOAuthConfig.oauthConfigs')[$oauthName]['allow_register'] === false) {

Check failure on line 96 in src/Controllers/OAuthController.php

View workflow job for this annotation

GitHub Actions / PHP 7.4 Static Analysis

Function setting not found.

Check failure on line 96 in src/Controllers/OAuthController.php

View workflow job for this annotation

GitHub Actions / PHP 8.0 Static Analysis

Function setting not found.

Check failure on line 96 in src/Controllers/OAuthController.php

View workflow job for this annotation

GitHub Actions / PHP 8.1 Static Analysis

Function setting not found.
return redirect()->to(config('Auth')->logoutRedirect())->with('error', lang('ShieldOAuthLang.Callback.account_not_found', [$userInfo->email]));
}

Expand Down Expand Up @@ -164,10 +164,10 @@ private function syncingUserInfo(array $find = [], array $updateFields = []): in
$users = model('ShieldOAuthModel');
$user = $users->findByCredentials($find);

$syncingUserInfo = config('ShieldOAuthConfig')->syncingUserInfo;
if ($syncingUserInfo === true) {
if (setting('ShieldOAuthConfig.syncingUserInfo') === true) {

Check failure on line 167 in src/Controllers/OAuthController.php

View workflow job for this annotation

GitHub Actions / PHP 7.4 Static Analysis

Function setting not found.

Check failure on line 167 in src/Controllers/OAuthController.php

View workflow job for this annotation

GitHub Actions / PHP 8.0 Static Analysis

Function setting not found.

Check failure on line 167 in src/Controllers/OAuthController.php

View workflow job for this annotation

GitHub Actions / PHP 8.1 Static Analysis

Function setting not found.
$user->fill($updateFields);
}

$users->save($user);

return $user->id;
Expand Down

0 comments on commit 8f25ed3

Please sign in to comment.