diff --git a/src/Core/Users/Commands/RequestPasswordResetHandler.php b/src/Core/Users/Commands/RequestPasswordResetHandler.php index 8c86ab41c..448052db5 100644 --- a/src/Core/Users/Commands/RequestPasswordResetHandler.php +++ b/src/Core/Users/Commands/RequestPasswordResetHandler.php @@ -1,5 +1,6 @@ users = $users; + $this->settings = $settings; $this->mailer = $mailer; $this->url = $url; } @@ -53,8 +66,8 @@ class RequestPasswordResetHandler // password route be part of core?? $data = [ 'username' => $user->username, - 'url' => Core::config('base_url').'/reset/'.$token->id, - 'forumTitle' => Core::config('forum_title') + 'url' => $this->settings->get('base_url').'/reset/'.$token->id, + 'forumTitle' => $this->settings->get('forum_title'), ]; $this->mailer->send(['text' => 'flarum::emails.resetPassword'], $data, function (Message $message) use ($user) { diff --git a/src/Core/Users/Listeners/EmailConfirmationMailer.php b/src/Core/Users/Listeners/EmailConfirmationMailer.php index cc259a077..111d3851a 100755 --- a/src/Core/Users/Listeners/EmailConfirmationMailer.php +++ b/src/Core/Users/Listeners/EmailConfirmationMailer.php @@ -1,5 +1,6 @@ settings = $settings; $this->mailer = $mailer; } @@ -90,8 +98,8 @@ class EmailConfirmationMailer // email route be part of core?? return [ 'username' => $user->username, - 'url' => Core::config('base_url').'/confirm/'.$token->id, - 'forumTitle' => Core::config('forum_title') + 'url' => $this->settings->get('base_url').'/confirm/'.$token->id, + 'forumTitle' => $this->settings->get('forum_title') ]; } } diff --git a/src/Support/ClientAction.php b/src/Support/ClientAction.php index d75c1e744..3ad5c5a96 100644 --- a/src/Support/ClientAction.php +++ b/src/Support/ClientAction.php @@ -5,6 +5,7 @@ use Flarum\Assets\AssetManager; use Flarum\Assets\JsCompiler; use Flarum\Assets\LessCompiler; use Flarum\Core; +use Flarum\Core\Settings\SettingsRepository; use Flarum\Core\Users\User; use Flarum\Locale\JsCompiler as LocaleJsCompiler; use Flarum\Locale\LocaleManager; @@ -61,14 +62,20 @@ abstract class ClientAction extends HtmlAction */ protected $locales; + /** + * @var SettingsRepository + */ + protected $settings; + /** * @param Client $apiClient * @param LocaleManager $locales */ - public function __construct(Client $apiClient, LocaleManager $locales) + public function __construct(Client $apiClient, LocaleManager $locales, SettingsRepository $settings) { $this->apiClient = $apiClient; $this->locales = $locales; + $this->settings = $settings; } /** @@ -156,7 +163,7 @@ abstract class ClientAction extends HtmlAction $assets->addLess("@$name: $value;"); } - $assets->addLess(Core::config('custom_less')); + $assets->addLess($this->settings->get('custom_less')); } /** @@ -168,10 +175,10 @@ abstract class ClientAction extends HtmlAction protected function getLessVariables() { return [ - 'fl-primary-color' => Core::config('theme_primary_color', '#000'), - 'fl-secondary-color' => Core::config('theme_secondary_color', '#000'), - 'fl-dark-mode' => Core::config('theme_dark_mode') ? 'true' : 'false', - 'fl-colored-header' => Core::config('theme_colored_header') ? 'true' : 'false' + 'fl-primary-color' => $this->settings->get('theme_primary_color', '#000'), + 'fl-secondary-color' => $this->settings->get('theme_secondary_color', '#000'), + 'fl-dark-mode' => $this->settings->get('theme_dark_mode') ? 'true' : 'false', + 'fl-colored-header' => $this->settings->get('theme_colored_header') ? 'true' : 'false' ]; }