Skip to content

Commit 66297ce

Browse files
committed
Merge branch 'develop'
# Conflicts: # .github/workflows/CodeQuality.yml
2 parents 36d67c2 + 8b5bf35 commit 66297ce

29 files changed

Lines changed: 310 additions & 100 deletions

.Build/composer.json

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
{
2+
"name": "derhansen/fe_change_pwd_build",
3+
"description": "composer.json for builds",
4+
"repositories": [
5+
{
6+
"type": "path",
7+
"url": "../"
8+
}
9+
],
10+
"require": {
11+
"derhansen/fe_change_pwd": "@dev",
12+
"typo3/cms-core": "^12.4",
13+
"ext-curl": "*",
14+
"ext-pdo": "*",
15+
"php": ">=8.1"
16+
},
17+
"require-dev": {
18+
"typo3/cms-backend": "^12.4",
19+
"typo3/cms-frontend": "^12.4",
20+
"typo3/cms-recordlist": "^12.4",
21+
"typo3/cms-extbase": "^12.4",
22+
"typo3/cms-fluid": "^12.4",
23+
"typo3/cms-composer-installers": "^5.0",
24+
"typo3/testing-framework": "^8.0.0 || dev-main",
25+
"friendsofphp/php-cs-fixer": "^3.12.0",
26+
"saschaegerer/phpstan-typo3": "^1.1.2",
27+
"phpstan/extension-installer": "^1.1"
28+
},
29+
"config": {
30+
"allow-plugins": {
31+
"typo3/class-alias-loader": true,
32+
"typo3/cms-composer-installers": true,
33+
"phpstan/extension-installer": true
34+
}
35+
}
36+
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@
6767
])
6868
->setFinder(
6969
PhpCsFixer\Finder::create()
70-
->in(__DIR__)
70+
->in(dirname(__DIR__ . '/../../../'))
7171
->exclude(['.Build', 'Documentation', 'Resources'])
7272
->notName('ext_emconf.php')
7373
);
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ parameters:
33
-
44
message: "#^Constructor of class Derhansen\\\\FeChangePwd\\\\Validation\\\\Validator\\\\ChangePasswordValidator has an unused parameter \\$options\\.$#"
55
count: 1
6-
path: Classes/Validation/Validator/ChangePasswordValidator.php
6+
path: ../../Classes/Validation/Validator/ChangePasswordValidator.php

.Build/phpstan/phpstan.neon

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
includes:
2+
- phpstan-baseline.neon
3+
4+
parameters:
5+
level: 6
6+
paths:
7+
- ../../Classes/
8+
- ../../Configuration/
9+
10+
checkMissingIterableValueType: false
11+
reportUnmatchedIgnoredErrors: true
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
>
1616
<testsuites>
1717
<testsuite name="unit">
18-
<directory>../Unit/</directory>
18+
<directory>../../Tests/Unit/</directory>
1919
</testsuite>
2020
</testsuites>
2121
</phpunit>

.github/workflows/CodeQuality.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,19 +28,20 @@ jobs:
2828
run: composer validate
2929

3030
- name: Cache dependencies
31-
uses: actions/cache@v2
31+
uses: actions/cache@v3
3232
with:
3333
path: ~/.composer/cache
3434
key: dependencies-composer-${{ hashFiles('composer.json') }}
3535

3636
- name: Install composer dependencies
3737
run: |
38+
cd .Build
3839
composer install --no-progress
3940
4041
- name: Validate PHP coding guidelines
4142
run: |
42-
.Build/bin/php-cs-fixer fix --config=.php-cs-fixer.dist.php -v --dry-run --stop-on-violation --using-cache=no
43+
.Build/vendor/bin/php-cs-fixer fix --config=.Build/php-cs-fixer/.php-cs-fixer.php -v --dry-run --stop-on-violation --using-cache=no
4344
4445
- name: Run phpstan checks
4546
run: |
46-
.Build/bin/phpstan
47+
.Build/vendor/bin/phpstan --configuration=.Build/phpstan/phpstan.neon
Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: CI
1+
name: Tests
22

33
on: [push, pull_request]
44

@@ -24,10 +24,17 @@ jobs:
2424
- name: Validate composer.json and composer.lock
2525
run: composer validate
2626

27+
- name: Cache dependencies
28+
uses: actions/cache@v3
29+
with:
30+
path: ~/.composer/cache
31+
key: dependencies-composer-${{ hashFiles('composer.json') }}
32+
2733
- name: Install dependencies
2834
run: |
35+
cd .Build
2936
composer require typo3/cms-core:${{ matrix.typo3 }} --no-progress
3037
git checkout composer.json
3138
3239
- name: Unit Tests
33-
run: .Build/bin/phpunit --colors -c Tests/Build/UnitTests.xml
40+
run: .Build/vendor/bin/phpunit --colors -c .Build/phpunit/UnitTests.xml

.gitignore

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
.idea/
22
.DS_Store
3-
.Build/
3+
.Build/public
4+
.Build/vendor
5+
.Build/var/
46
composer.lock
5-
var/
6-
.phpunit.result.cache
7-
.phpunit.cache
87
.php-cs-fixer.cache
8+
.phpunit.cache

Classes/Controller/PasswordController.php

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,12 @@
1313

1414
use Derhansen\FeChangePwd\Domain\Model\Dto\ChangePassword;
1515
use Derhansen\FeChangePwd\Event\AfterPasswordUpdatedEvent;
16+
use Derhansen\FeChangePwd\Exception\InvalidEmailAddressException;
1617
use Derhansen\FeChangePwd\Exception\MissingFeatureToggleException;
1718
use Derhansen\FeChangePwd\Service\FrontendUserService;
1819
use Psr\Http\Message\ResponseInterface;
1920
use TYPO3\CMS\Core\Configuration\Features;
21+
use TYPO3\CMS\Core\Type\ContextualFeedbackSeverity;
2022
use TYPO3\CMS\Extbase\Annotation as Extbase;
2123
use TYPO3\CMS\Extbase\Mvc\Controller\ActionController;
2224
use TYPO3\CMS\Extbase\Security\Exception\InvalidHashException;
@@ -27,8 +29,7 @@ class PasswordController extends ActionController
2729
public function __construct(
2830
protected readonly FrontendUserService $frontendUserService,
2931
protected readonly Features $features,
30-
) {
31-
}
32+
) {}
3233

3334
public function initializeAction(): void
3435
{
@@ -93,6 +94,28 @@ public function updateAction(ChangePassword $changePassword): ResponseInterface
9394
return $this->htmlResponse();
9495
}
9596

97+
/**
98+
* Sends an email with the verification code to the current frontend user
99+
*/
100+
public function sendChangePasswordCodeAction(): ResponseInterface
101+
{
102+
try {
103+
$this->frontendUserService->sendChangePasswordCodeEmail($this->settings, $this->request);
104+
$this->addFlashMessage(
105+
LocalizationUtility::translate('changePasswordCodeSent', 'FeChangePwd'),
106+
LocalizationUtility::translate('changePasswordCodeSent.title', 'FeChangePwd')
107+
);
108+
} catch (InvalidEmailAddressException $exception) {
109+
$this->addFlashMessage(
110+
LocalizationUtility::translate('changePasswordCodeInvalidEmail', 'FeChangePwd'),
111+
LocalizationUtility::translate('changePasswordCodeInvalidEmail.title', 'FeChangePwd'),
112+
ContextualFeedbackSeverity::ERROR
113+
);
114+
}
115+
116+
return $this->redirect('edit');
117+
}
118+
96119
/**
97120
* Suppress default flash messages
98121
*/

Classes/Domain/Model/Dto/ChangePassword.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ class ChangePassword
1616
protected string $password1 = '';
1717
protected string $password2 = '';
1818
protected string $currentPassword = '';
19+
protected string $changePasswordCode = '';
1920
protected string $changeHmac = '';
2021
protected bool $skipCurrentPasswordCheck = false;
2122

@@ -49,6 +50,16 @@ public function setCurrentPassword(string $currentPassword): void
4950
$this->currentPassword = $currentPassword;
5051
}
5152

53+
public function getChangePasswordCode(): string
54+
{
55+
return $this->changePasswordCode;
56+
}
57+
58+
public function setChangePasswordCode(string $changePasswordCode): void
59+
{
60+
$this->changePasswordCode = $changePasswordCode;
61+
}
62+
5263
public function getChangeHmac(): string
5364
{
5465
return $this->changeHmac;

0 commit comments

Comments
 (0)