Release 2.13 (#4659)

This commit is contained in:
Kevin Papst
2024-03-10 15:35:59 +01:00
committed by GitHub
parent a78e8ed8c4
commit dee90bb15e
79 changed files with 1019 additions and 932 deletions

View File

@@ -67,7 +67,7 @@ final class CustomerController extends AbstractController
$query->setCurrentUser($this->getUser());
$query->setPage($page);
$form = $this->getToolbarForm($query);
$form = $this->getToolbarForm($query, $request);
if ($this->handleSearch($form, $request)) {
return $this->redirectToRoute('admin_customer');
}
@@ -473,7 +473,7 @@ final class CustomerController extends AbstractController
$query = new CustomerQuery();
$query->setCurrentUser($this->getUser());
$form = $this->getToolbarForm($query);
$form = $this->getToolbarForm($query, $request);
$form->setData($query);
$form->submit($request->query->all(), false);
@@ -526,12 +526,12 @@ final class CustomerController extends AbstractController
}
/**
* @param CustomerQuery $query
* @return FormInterface<CustomerQuery>
*/
private function getToolbarForm(CustomerQuery $query): FormInterface
private function getToolbarForm(CustomerQuery $query, Request $request): FormInterface
{
return $this->createSearchForm(CustomerToolbarForm::class, $query, [
'locale' => $request->getLocale(),
'action' => $this->generateUrl('admin_customer', [
'page' => $query->getPage(),
])
@@ -539,7 +539,6 @@ final class CustomerController extends AbstractController
}
/**
* @param CustomerComment $comment
* @return FormInterface<CustomerComment>
*/
private function getCommentForm(CustomerComment $comment): FormInterface
@@ -555,7 +554,6 @@ final class CustomerController extends AbstractController
}
/**
* @param Customer $customer
* @return FormInterface<Customer>
*/
private function createEditForm(Customer $customer): FormInterface

View File

@@ -45,21 +45,28 @@ final class PluginController extends AbstractController
private function getPluginInformation(HttpClientInterface $client, CacheInterface $cache): array
{
return $cache->get('kimai.marketplace_extensions', function (ItemInterface $item) use ($client) {
$response = $client->request('GET', 'https://www.kimai.org/plugins.json');
try {
$response = $client->request('GET', 'https://www.kimai.org/plugins.json');
if ($response->getStatusCode() !== 200) {
return [];
if ($response->getStatusCode() !== 200) {
return [];
}
$json = json_decode($response->getContent(), true);
if ($json === null) {
return [];
}
$item->expiresAfter(86400); // one day
return $response->toArray();
} catch (\Exception $exception) {
$this->logException($exception);
$this->flashError('Could not download plugin information');
}
$json = json_decode($response->getContent(), true);
if ($json === null) {
return [];
}
$item->expiresAfter(86400); // one day
return $response->toArray();
return [];
});
}
}

View File

@@ -32,9 +32,9 @@ use Symfony\Contracts\Translation\TranslatorInterface;
final class PasswordResetController extends AbstractController
{
public function __construct(
private EventDispatcherInterface $eventDispatcher,
private UserService $userService,
private SystemConfiguration $configuration
private readonly EventDispatcherInterface $eventDispatcher,
private readonly UserService $userService,
private readonly SystemConfiguration $configuration
) {
}
@@ -62,6 +62,10 @@ final class PasswordResetController extends AbstractController
}
$username = $request->request->get('username');
if (!\is_string($username) || trim($username) === '') {
throw $this->createAccessDeniedException('Username cannot be empty');
}
$user = $this->userService->findUserByUsernameOrEmail($username);
if (!$user->isPasswordRequestNonExpired($this->configuration->getPasswordResetRetryLifetime())) {