Skip to content

Commit 4a4e49f

Browse files
author
Jacob de Keizer
committed
Update readme and add notification to backend screens
1 parent cc5717a commit 4a4e49f

6 files changed

Lines changed: 45 additions & 2 deletions

File tree

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,12 @@ php artisan vendor:publish --provider="Vdlp\BasicAuthentication\ServiceProviders
2929
This will create a `config/basicauthentication.php` file in your app where you can modify the configuration if you don't
3030
want to use .env variables.
3131

32+
## Enable / disable plugin
33+
34+
By default basic authentication is disabled.
35+
36+
To enable basic authentication, you have to set the env variable to `BASIC_AUTHENTICATION_ENABLED` to `true` in your `.env` file or edit the published config file.
37+
3238
## Questions? Need help?
3339

3440
If you have any question about how to use this plugin, please don't hesitate to contact us at octobercms@vdlp.nl. We're happy to help you. You can also visit the support forum and drop your questions/issues there.

controllers/Credentials.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
use Backend\Behaviors\ListController;
99
use Backend\Classes\NavigationManager;
1010
use Backend\Classes\Controller;
11+
use Illuminate\Contracts\Config\Repository;
1112
use System\Classes\SettingsManager;
1213

1314
/**
@@ -36,14 +37,19 @@ class Credentials extends Controller
3637
/** {@inheritdoc} */
3738
public $requiredPermissions = ['vdlp.basicauthentication.access_settings'];
3839

40+
/** @var bool */
41+
public $enabled;
42+
3943
/**
4044
* {@inheritdoc}
4145
*/
42-
public function __construct()
46+
public function __construct(Repository $config)
4347
{
4448
parent::__construct();
4549

4650
NavigationManager::instance()->setContext('October.System', 'system', 'settings');
4751
SettingsManager::setContext('Vdlp.BasicAuthentication', 'credentials');
52+
53+
$this->enabled = $config->get('basicauthentication.enabled');
4854
}
4955
}

controllers/ExcludedUrls.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
use Backend\Behaviors\ListController;
99
use Backend\Classes\NavigationManager;
1010
use Backend\Classes\Controller;
11+
use Illuminate\Contracts\Config\Repository;
1112
use System\Classes\SettingsManager;
1213

1314
/**
@@ -36,14 +37,19 @@ class ExcludedUrls extends Controller
3637
/** {@inheritdoc} */
3738
public $requiredPermissions = ['vdlp.basicauthentication.access_settings'];
3839

40+
/** @var bool */
41+
public $enabled;
42+
3943
/**
4044
* {@inheritdoc}
4145
*/
42-
public function __construct()
46+
public function __construct(Repository $config)
4347
{
4448
parent::__construct();
4549

4650
NavigationManager::instance()->setContext('October.System', 'system', 'settings');
4751
SettingsManager::setContext('Vdlp.BasicAuthentication', 'excludedurls');
52+
53+
$this->enabled = $config->get('basicauthentication.enabled');
4854
}
4955
}

controllers/credentials/index.htm

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,12 @@
1+
<?php if(!$this->enabled): ?>
2+
<div class="container-fluid">
3+
<div class="callout fade in callout-warning no-subheader">
4+
<div class="header">
5+
<i class="icon-warning"></i>
6+
<h3><?= e(trans('vdlp.basicauthentication::lang.notifications.disabled')) ?></h3>
7+
</div>
8+
</div>
9+
</div>
10+
<?php endif; ?>
11+
112
<?= $this->listRender() ?>

controllers/excludedurls/index.htm

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,12 @@
1+
<?php if(!$this->enabled): ?>
2+
<div class="container-fluid">
3+
<div class="callout fade in callout-warning no-subheader">
4+
<div class="header">
5+
<i class="icon-warning"></i>
6+
<h3><?= e(trans('vdlp.basicauthentication::lang.notifications.disabled')) ?></h3>
7+
</div>
8+
</div>
9+
</div>
10+
<?php endif; ?>
11+
112
<?= $this->listRender() ?>

lang/en/lang.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,4 +58,7 @@
5858
'create_button' => 'New excluded URL',
5959
],
6060
],
61+
'notifications' => [
62+
'disabled' => 'Basic Authentication is disabled, you can enable it in the configuration file. Read the README for more information.',
63+
],
6164
];

0 commit comments

Comments
 (0)