diff --git a/CHANGELOG.md b/CHANGELOG.md index ba95844..c7b6db9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,7 +4,6 @@ ### Changed - Now requires Craft 4 & PHP 8.0.2 -- `Provider::getConfiguredProvider()` now returns `ProviderInterface` instead of `AbstractProvider` ### Removed - Removed route `oauthclient/authorize/refresh/` use `oauth/authorize/refresh/` instead diff --git a/src/base/Provider.php b/src/base/Provider.php index 7d735a5..799d32c 100644 --- a/src/base/Provider.php +++ b/src/base/Provider.php @@ -53,7 +53,7 @@ public function getDefaultAuthorizationUrlOptions(): array * @inheritDoc * @throws ReflectionException */ - public function getConfiguredProvider(): ProviderInterface + public function getConfiguredProvider(): AbstractProvider { if ($this->configuredProvider instanceof AbstractProvider) { return $this->configuredProvider; diff --git a/src/base/ProviderInterface.php b/src/base/ProviderInterface.php index 4bfc30e..871381e 100644 --- a/src/base/ProviderInterface.php +++ b/src/base/ProviderInterface.php @@ -28,9 +28,9 @@ public static function getProviderClass(): string; /** * Gets a concrete League provider instance - * @return ProviderInterface + * @return AbstractProvider */ - public function getConfiguredProvider(): ProviderInterface; + public function getConfiguredProvider(): AbstractProvider; /** * Get the URL used to authorize the token diff --git a/src/controllers/AppsController.php b/src/controllers/AppsController.php index d2629fa..cd8ed3a 100644 --- a/src/controllers/AppsController.php +++ b/src/controllers/AppsController.php @@ -161,14 +161,13 @@ public function actionSave(): ?\yii\web\Response // Save it if (!Plugin::getInstance()->apps->saveApp($app)) { - $session->setError(Craft::t('oauthclient', 'Failed to save app')); - // Send the volume back to the template - Craft::$app->getUrlManager()->setRouteParams([ + // TODO: Switch to asModelFailure + return $this->asFailure('Failed to save app', [], [ 'app' => $app ]); - return null; } + // TODO: Switch to asModuleSuccess $session->setNotice(Craft::t('oauthclient', 'App saved')); return $this->redirect(UrlHelper::cpUrl('oauthclient/apps/' . $app->handle . ($isNew ? '#info-tab' : ''))); } diff --git a/src/models/App.php b/src/models/App.php index 74e286a..28becf7 100644 --- a/src/models/App.php +++ b/src/models/App.php @@ -41,7 +41,7 @@ class App extends Model public ?string $provider = null; public ?string $name = null; public ?string $handle = null; - public ?int $clientId = null; + public ?string $clientId = null; public ?string $clientSecret = null; public ?string $urlAuthorize = null; @@ -84,7 +84,7 @@ public function getClientSecret(): string */ public function getUrlAuthorize(): string { - return \craft\helpers\App::parseEnv($this->urlAuthorize); + return \craft\helpers\App::parseEnv($this->urlAuthorize) ?: ''; } /**