Skip to content

Commit 5817ebb

Browse files
committed
Merge branch 'release/3.0.0'
2 parents 05d5b42 + c15514f commit 5817ebb

27 files changed

+268
-342
lines changed

.github/workflows/php.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@ jobs:
2828
php-version: ${{ matrix.php }}
2929
coverage: none
3030

31+
- name: Add HTTP basic auth credentials
32+
run: echo '${{ secrets.VDLP_OCTOBER_CMS_AUTH_JSON }}' > $GITHUB_WORKSPACE/auth.json
33+
3134
- name: Validate composer.json and composer.lock
3235
run: composer validate
3336

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,14 @@ All notable changes to this project will be documented in this file.
44
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
55
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
66

7+
## [3.0.0] - 2022-03-14
8+
9+
- !! Dropped logic for "Excluded URLs". Please add whitelisted paths after upgrading to this version.
10+
- !! Passwords are now stored as hashed _values_ and you should change the passwords after upgrading.
11+
- Add whitelisting for specific paths (two match types; `exact` and `starts_with`).
12+
- Add composer requirement `october/system:>=1.0`.
13+
- Old (plain text stored) password do still work.
14+
715
## [2.1.0] - 2022-02-15
816

917
- Maintenance update:

Plugin.php

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -76,16 +76,6 @@ public function registerSettings(): array
7676
'keywords' => 'basic authentication security',
7777
'order' => 500,
7878
],
79-
'excludedurls' => [
80-
'label' => 'vdlp.basicauthentication::lang.excludedurls.label',
81-
'description' => 'vdlp.basicauthentication::lang.excludedurls.description',
82-
'url' => $backendHelper->url('vdlp/basicauthentication/excludedurls'),
83-
'category' => 'Basic Authentication',
84-
'icon' => 'icon-link',
85-
'permissions' => ['vdlp.basicauthentication.*'],
86-
'keywords' => 'basic authentication security',
87-
'order' => 501,
88-
],
8979
];
9080
}
9181
}

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ Allows users to manage Basic Authentication credentials for multiple hostnames a
44

55
## Requirements
66

7+
* October CMS ^1.1
78
* PHP 7.4 or higher
89

910
## Installation

composer.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,12 @@
1414
},
1515
"require": {
1616
"php": "^7.4 || ^8.0",
17+
"october/system": ">=1.0",
1718
"composer/installers": "^1.0 || ^2.0"
1819
},
1920
"archive": {
2021
"exclude": [
22+
".gitattributes",
2123
".gitignore",
2224
".github"
2325
]

console/CreateCredentialsCommand.php

Lines changed: 28 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -18,24 +18,38 @@ public function __construct()
1818
parent::__construct();
1919
}
2020

21-
public function handle(): void
21+
public function handle(): int
2222
{
23+
$exists = Credential::query()
24+
->where('hostname', $this->argument('hostname'))
25+
->exists();
26+
27+
if ($exists) {
28+
$this->error('Hostname already exists.');
29+
30+
return 1;
31+
}
32+
2333
try {
24-
Credential::query()
25-
->updateOrInsert([
26-
'hostname' => $this->argument('hostname'),
27-
], [
28-
'realm' => $this->argument('realm'),
29-
'username' => $this->argument('username'),
30-
'password' => $this->argument('password'),
31-
'is_enabled' => true,
32-
'updated_at' => now(),
33-
'created_at' => now(),
34-
]);
35-
36-
$this->info('Basic Authentication credentials have been added to the database.');
34+
$credential = new Credential([
35+
'hostname' => $this->argument('hostname'),
36+
'realm' => $this->argument('realm'),
37+
'username' => $this->argument('username'),
38+
'password' => $this->argument('password'),
39+
'is_enabled' => true,
40+
'updated_at' => now(),
41+
'created_at' => now(),
42+
]);
43+
44+
$credential->forceSave();
3745
} catch (Throwable $throwable) {
3846
$this->error('Could not create Basic Authentication credentials: ' . $throwable->getMessage());
47+
48+
return 2;
3949
}
50+
51+
$this->info('Basic Authentication credentials have been added to the database.');
52+
53+
return 0;
4054
}
4155
}

controllers/Credentials.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ public function __construct(Repository $config)
3232
parent::__construct();
3333

3434
NavigationManager::instance()->setContext('October.System', 'system', 'settings');
35+
3536
SettingsManager::setContext('Vdlp.BasicAuthentication', 'credentials');
3637

3738
$this->enabled = (bool) $config->get('basicauthentication.enabled', false);

controllers/ExcludedUrls.php

Lines changed: 0 additions & 39 deletions
This file was deleted.

controllers/credentials/update.htm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
<button
2020
type="submit"
2121
data-request="onSave"
22-
data-request-data="redirect:0"
22+
data-request-data="redirect:0,refresh:1"
2323
data-hotkey="ctrl+s, cmd+s"
2424
data-load-indicator="<?= e(trans('backend::lang.form.saving')) ?>"
2525
class="btn btn-primary">

controllers/excludedurls/_list_toolbar.htm

Lines changed: 0 additions & 7 deletions
This file was deleted.

controllers/excludedurls/config_form.yaml

Lines changed: 0 additions & 14 deletions
This file was deleted.

controllers/excludedurls/config_list.yaml

Lines changed: 0 additions & 14 deletions
This file was deleted.

controllers/excludedurls/create.htm

Lines changed: 0 additions & 53 deletions
This file was deleted.

controllers/excludedurls/index.htm

Lines changed: 0 additions & 12 deletions
This file was deleted.

controllers/excludedurls/update.htm

Lines changed: 0 additions & 61 deletions
This file was deleted.

0 commit comments

Comments
 (0)