Skip to content

Commit 7f7a3bd

Browse files
committed
ISSUE-345: readme
1 parent 4091d52 commit 7f7a3bd

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ phpList is an open source newsletter manager.
1515
## About this package
1616

1717
This module will contain the web frontend for phpList 4. It will not have any
18-
SQL queries, but use functionality from the phpList 4 core for DB access.
18+
SQL queries but use functionality from the phpList 4 core for DB access.
1919

2020
This module is optional, i.e., it will be possible to run phpList 4 without a
2121
web frontend.
@@ -38,3 +38,7 @@ contribute and how to run the unit tests and style checks locally.
3838
This project adheres to a [Contributor Code of Conduct](CODE_OF_CONDUCT.md).
3939
By participating in this project and its community, you are expected to uphold
4040
this code.
41+
42+
## Command to running this project for local testing
43+
44+
symfony local:server:start

src/Controller/SecurityController.php renamed to src/Controller/AuthController.php

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,26 +9,22 @@
99
use PhpList\WebFrontend\Service\ApiClient;
1010
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
1111
use Symfony\Component\HttpFoundation\Request;
12-
use Symfony\Component\HttpFoundation\RequestStack;
1312
use Symfony\Component\HttpFoundation\Response;
14-
use Symfony\Component\HttpFoundation\Session\SessionInterface;
1513
use Symfony\Component\Routing\Attribute\Route;
1614

17-
class SecurityController extends AbstractController
15+
class AuthController extends AbstractController
1816
{
1917
private ApiClient $apiClient;
20-
private SessionInterface $session;
2118

22-
public function __construct(ApiClient $apiClient, RequestStack $requestStack)
19+
public function __construct(ApiClient $apiClient)
2320
{
2421
$this->apiClient = $apiClient;
25-
$this->session = $requestStack->getSession();
2622
}
2723

2824
#[Route('/login', name: 'login', methods: ['GET', 'POST'])]
2925
public function login(Request $request): Response
3026
{
31-
if ($this->session->has('auth_token')) {
27+
if ($request->getSession()->has('auth_token')) {
3228
return $this->redirectToRoute('empty_start_page');
3329
}
3430

@@ -40,8 +36,8 @@ public function login(Request $request): Response
4036

4137
try {
4238
$authData = $this->apiClient->authenticate($username, $password);
43-
$this->session->set('auth_token', $authData['key']);
44-
$this->session->set('auth_expiry_date', $authData['key']);
39+
$request->getSession()->set('auth_token', $authData['key']);
40+
$request->getSession()->set('auth_expiry_date', $authData['key']);
4541
$this->apiClient->setAuthToken($authData['key']);
4642

4743
return $this->redirectToRoute('empty_start_page');
@@ -58,9 +54,9 @@ public function login(Request $request): Response
5854
}
5955

6056
#[Route('/logout', name: 'logout')]
61-
public function logout(): Response
57+
public function logout(Request $request): Response
6258
{
63-
$this->session->remove('auth_token');
59+
$request->getSession()->remove('auth_token');
6460

6561
return $this->redirectToRoute('login');
6662
}

0 commit comments

Comments
 (0)