|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
declare(strict_types=1); |
|
4
|
|
|
|
|
5
|
|
|
namespace Stu\Component\Player\Deletion\Confirmation; |
|
6
|
|
|
|
|
7
|
|
|
use Noodlehaus\ConfigInterface; |
|
8
|
|
|
use RuntimeException; |
|
9
|
|
|
use Stu\Lib\Mail\MailFactoryInterface; |
|
10
|
|
|
use Stu\Module\Control\StuHashInterface; |
|
11
|
|
|
use Stu\Module\PlayerSetting\Lib\UserEnum; |
|
|
|
|
|
|
12
|
|
|
use Stu\Orm\Entity\UserInterface; |
|
13
|
|
|
use Stu\Orm\Repository\UserRepositoryInterface; |
|
14
|
|
|
|
|
15
|
|
|
final class RequestDeletionConfirmation implements RequestDeletionConfirmationInterface |
|
16
|
|
|
{ |
|
17
|
1 |
|
public function __construct( |
|
18
|
|
|
private UserRepositoryInterface $userRepository, |
|
19
|
|
|
private MailFactoryInterface $mailFactory, |
|
20
|
|
|
private ConfigInterface $config, |
|
21
|
|
|
private StuHashInterface $stuHash |
|
22
|
1 |
|
) {} |
|
23
|
|
|
|
|
24
|
|
|
public function request(UserInterface $user): void |
|
25
|
|
|
{ |
|
26
|
|
|
$registration = $user->getRegistration(); |
|
27
|
|
|
$token = $this->stuHash->hash(time() . $registration->getCreationDate()); |
|
28
|
|
|
|
|
29
|
|
|
$registration->setDeletionMark(UserEnum::DELETION_REQUESTED); |
|
30
|
|
|
$registration->setPasswordToken($token); |
|
31
|
|
|
|
|
32
|
|
|
$body = <<<EOT |
|
33
|
|
|
Hallo\n\n |
|
34
|
|
|
Du hast eine Accountlöschung in Star Trek Universe angefordert.\n\n |
|
35
|
|
|
Bitte bestätige die Löschung mittels Klick auf folgenden Link:\n |
|
36
|
|
|
%s/?CONFIRM_ACCOUNT_DELETION=1&token=%s\n |
|
37
|
|
|
Das STU-Team\n\n, |
|
38
|
|
|
EOT; |
|
39
|
|
|
|
|
40
|
|
|
$mail = $this->mailFactory->createStuMail() |
|
41
|
|
|
->withDefaultSender() |
|
42
|
|
|
->addTo($registration->getEmail()) |
|
43
|
|
|
->setSubject('Star Trek Universe - Accountlöschung') |
|
44
|
|
|
->setBody( |
|
45
|
|
|
sprintf( |
|
46
|
|
|
$body, |
|
47
|
|
|
$this->config->get('game.base_url'), |
|
48
|
|
|
$token, |
|
49
|
|
|
) |
|
50
|
|
|
); |
|
51
|
|
|
|
|
52
|
|
|
try { |
|
53
|
|
|
$mail->send(); |
|
54
|
|
|
} catch (RuntimeException) { |
|
55
|
|
|
return; |
|
56
|
|
|
} |
|
57
|
|
|
|
|
58
|
|
|
$this->userRepository->save($user); |
|
59
|
|
|
} |
|
60
|
|
|
} |
|
61
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths