diff --git a/src/PasswordPolicy.php b/src/PasswordPolicy.php index 1f006ac..dd1cc4e 100644 --- a/src/PasswordPolicy.php +++ b/src/PasswordPolicy.php @@ -28,21 +28,15 @@ use craft\web\twig\variables\CraftVariable; use craft\web\UrlManager; use craft\web\View; - use craftpulse\passwordpolicy\assetbundles\passwordpolicy\PasswordPolicyAsset; use craftpulse\passwordpolicy\models\SettingsModel; use craftpulse\passwordpolicy\rules\UserRules; use craftpulse\passwordpolicy\services\ServicesTrait; use craftpulse\passwordpolicy\utilities\RetentionUtility; use craftpulse\passwordpolicy\variables\PasswordPolicyVariable; - use Monolog\Formatter\LineFormatter; - -use nystudio107\pluginvite\services\VitePluginService; -use nystudio107\pluginvite\services\ViteService; use Psr\Log\LogLevel; use Throwable; -use Yii; use yii\base\Event; use yii\base\InvalidRouteException; use yii\log\Dispatcher; @@ -55,10 +49,7 @@ * @package PasswordPolicy * @since 5.0.0 * - * @property-read ViteService $vite - * @property RetentionService $retention - * @property PasswordService $passwords - * + * @method Settings getSettings() */ class PasswordPolicy extends Plugin { @@ -76,31 +67,27 @@ class PasswordPolicy extends Plugin // Public Properties // ========================================================================= + /** + * @var null|SettingsModel + */ + public static ?SettingsModel $settings = null; /** * @var string */ public string $schemaVersion = '1.0.0'; - /** * @var bool */ public bool $hasCpSection = true; - /** * @var bool */ public bool $hasCpSettings = true; - /** * @var mixed|object|null */ public mixed $queue = null; - /** - * @var null|SettingsModel - */ - public static ?SettingsModel $settings = null; - public function init(): void { parent::init(); @@ -116,7 +103,6 @@ public function init(): void // Install our global event handlers $this->installEventHandlers(); - $this->installCpEventHandlers(); // Register control panel events if (Craft::$app->getRequest()->getIsCpRequest()) { @@ -208,7 +194,7 @@ protected function settingsHtml(): ?string { return Craft::$app->getView()->renderTemplate( 'password-policy/_settings', - [ 'settings' => $this->getSettings() ] + ['settings' => $this->getSettings()] ); } @@ -284,13 +270,6 @@ function(TemplateEvent $event) { // Register Asset Bundle $view->registerAssetBundle(PasswordPolicyAsset::class); - //$tagOptions = [ - // 'depends' => [ - // 'craftpulse\\passwordpolicy\\assetbundles\\passwordpolicy\\PasswordPolicyAsset' - // ], - //]; - $manifestPath = '@craftpulse/passwordpolicy/web/assets/dist/'; - $this->vite->manifestPath = rtrim(Yii::getAlias($manifestPath), '/\\'); //$this->vite->manifestPath = $manifestPath; $this->vite->register('src/js/indicator.ts', false); } diff --git a/src/services/ServicesTrait.php b/src/services/ServicesTrait.php index e98142f..b081cc0 100644 --- a/src/services/ServicesTrait.php +++ b/src/services/ServicesTrait.php @@ -28,6 +28,7 @@ public static function config(): array 'vite' => [ 'assetClass' => PasswordPolicyAsset::class, 'checkDevServer' => true, + 'useForAllRequests' => true, 'class' => VitePluginService::class, 'devServerInternal' => 'http://craft-password-policy-v5-buildchain-dev:3005', 'devServerPublic' => 'http://localhost:3005', @@ -44,10 +45,10 @@ public static function config(): array /** * Returns the passwords service * - * @return Events The events service + * @return Passwords The passwords service * @throws InvalidConfigException */ - public function getPasswords(): Events + public function getPasswords(): Passwords { return $this->get('passwords'); } @@ -55,10 +56,10 @@ public function getPasswords(): Events /** * Returns the retention service * - * @return Redirects The redirects service + * @return Retention The retention service * @throws InvalidConfigException */ - public function getRetention(): Redirects + public function getRetention(): Retention { return $this->get('retention'); }