• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

klinge / sl-webapp / 18972011891

31 Oct 2025 12:06PM UTC coverage: 74.73% (+11.1%) from 63.602%
18972011891

push

github

klinge
Fixed phpcs errors

1662 of 2224 relevant lines covered (74.73%)

3.82 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/App/Controllers/Auth/RegistrationController.php
1
<?php
2

3
declare(strict_types=1);
4

5
namespace App\Controllers\Auth;
6

7
use App\Services\UrlGeneratorService;
8
use App\Services\Auth\UserAuthenticationService;
9
use App\Traits\ResponseFormatter;
10
use App\Utils\Session;
11
use App\Utils\View;
12
use Psr\Http\Message\ServerRequestInterface;
13
use Psr\Http\Message\ResponseInterface;
14
use Monolog\Logger;
15
use League\Container\Container;
16

17
class RegistrationController extends AuthBaseController
18
{
19
    use ResponseFormatter;
20

21
    private const REGISTER_VIEW = 'login/viewRegisterAccount';
22

23
    private UserAuthenticationService $userAuthService;
24
    private View $view;
25

26
    public function __construct(
27
        UrlGeneratorService $urlGenerator,
28
        ServerRequestInterface $request,
29
        Logger $logger,
30
        Container $container,
31
        string $turnstileSecret,
32
        UserAuthenticationService $userAuthSvc,
33
        View $view
34
    ) {
35
        parent::__construct($urlGenerator, $request, $logger, $container, $turnstileSecret);
×
36
        $this->userAuthService = $userAuthSvc;
×
37
        $this->view = $view;
×
38
    }
39

40
    public function showRegister(): ResponseInterface
41
    {
42
        $this->setCsrfToken();
×
43
        return $this->view->render(self::REGISTER_VIEW);
×
44
    }
45

46
    public function register(): ResponseInterface
47
    {
48
        if (!$this->validateRecaptcha()) {
×
49
            return $this->renderWithError(self::REGISTER_VIEW, self::RECAPTCHA_ERROR_MESSAGE);
×
50
        }
51

52
        $result = $this->userAuthService->registerUser($this->request->getParsedBody());
×
53

54
        if (!$result['success']) {
×
55
            return $this->redirectWithError('show-register', $result['message']);
×
56
        }
57

58
        Session::setFlashMessage('success', 'E-post med verifieringslänk har skickats till din e-postadress.');
×
59
        return $this->view->render('login/viewLogin');
×
60
    }
61

62
    public function activate(ServerRequestInterface $request, array $params): ResponseInterface
63
    {
64
        $result = $this->userAuthService->activateAccount($params['token']);
×
65

66
        if (!$result['success']) {
×
67
            return $this->redirectWithError('login', $result['message']);
×
68
        } else {
69
            return $this->redirectWithSuccess('login', 'Ditt konto är nu aktiverat. Du kan nu logga in.');
×
70
        }
71
    }
72
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc