34
34
use TYPO3 \CMS \Beuser \Service \UserInformationService ;
35
35
use TYPO3 \CMS \Core \Authentication \BackendUserAuthentication ;
36
36
use TYPO3 \CMS \Core \Context \Context ;
37
+ use TYPO3 \CMS \Core \Http \AllowedMethodsTrait ;
37
38
use TYPO3 \CMS \Core \Imaging \IconFactory ;
38
39
use TYPO3 \CMS \Core \Imaging \IconSize ;
39
40
use TYPO3 \CMS \Core \Page \PageRenderer ;
55
56
*/
56
57
class BackendUserController extends ActionController
57
58
{
59
+ use AllowedMethodsTrait;
60
+
58
61
protected ?ModuleData $ moduleData = null ;
59
62
protected ModuleTemplate $ moduleTemplate ;
60
63
@@ -309,6 +312,11 @@ public function compareAction(): ResponseInterface
309
312
return $ this ->moduleTemplate ->renderResponse ('BackendUser/Compare ' );
310
313
}
311
314
315
+ protected function initializeInitiatePasswordResetAction (): void
316
+ {
317
+ $ this ->assertAllowedHttpMethod ($ this ->request , 'POST ' );
318
+ }
319
+
312
320
/**
313
321
* Starts the password reset process for a selected user.
314
322
*/
@@ -335,7 +343,12 @@ public function initiatePasswordResetAction(int $user): ResponseInterface
335
343
LocalizationUtility::translate ('LLL:EXT:beuser/Resources/Private/Language/locallang.xlf:flashMessage.resetPassword.success.title ' , 'beuser ' ) ?? ''
336
344
);
337
345
}
338
- return new ForwardResponse ('list ' );
346
+ return $ this ->redirect ('list ' );
347
+ }
348
+
349
+ protected function initializeAddToCompareListAction (): void
350
+ {
351
+ $ this ->assertAllowedHttpMethod ($ this ->request , 'POST ' );
339
352
}
340
353
341
354
/**
@@ -344,7 +357,12 @@ public function initiatePasswordResetAction(int $user): ResponseInterface
344
357
public function addToCompareListAction (int $ uid ): ResponseInterface
345
358
{
346
359
$ this ->addToCompareList ('compareUserList ' , $ uid );
347
- return new ForwardResponse ('list ' );
360
+ return $ this ->redirect ('list ' );
361
+ }
362
+
363
+ protected function initializeRemoveFromCompareListAction (): void
364
+ {
365
+ $ this ->assertAllowedHttpMethod ($ this ->request , 'POST ' );
348
366
}
349
367
350
368
/**
@@ -359,6 +377,11 @@ public function removeFromCompareListAction(int $uid, int $redirectToCompare = 0
359
377
return $ this ->redirect ('list ' );
360
378
}
361
379
380
+ protected function initializeRemoveAllFromCompareListAction (): void
381
+ {
382
+ $ this ->assertAllowedHttpMethod ($ this ->request , 'POST ' );
383
+ }
384
+
362
385
/**
363
386
* Removes all backend users from the compare list
364
387
*/
@@ -368,6 +391,11 @@ public function removeAllFromCompareListAction(): ResponseInterface
368
391
return $ this ->redirect ('list ' );
369
392
}
370
393
394
+ protected function initializeTerminateBackendUserSessionAction (): void
395
+ {
396
+ $ this ->assertAllowedHttpMethod ($ this ->request , 'POST ' );
397
+ }
398
+
371
399
/**
372
400
* Terminate BackendUser session and logout corresponding client
373
401
* Redirects to onlineAction with message
@@ -379,7 +407,7 @@ protected function terminateBackendUserSessionAction(string $sessionId): Respons
379
407
if ($ success ) {
380
408
$ this ->addFlashMessage (LocalizationUtility::translate ('LLL:EXT:beuser/Resources/Private/Language/locallang.xlf:backendUser.online.flashMessage.terminateSessionSuccess ' , 'beuser ' ) ?? '' );
381
409
}
382
- return new ForwardResponse ('online ' );
410
+ return $ this -> redirect ('online ' );
383
411
}
384
412
385
413
/**
@@ -475,6 +503,11 @@ public function compareGroupsAction(): ResponseInterface
475
503
return $ this ->moduleTemplate ->renderResponse ('BackendUserGroup/Compare ' );
476
504
}
477
505
506
+ protected function initializeAddGroupToCompareListAction (): void
507
+ {
508
+ $ this ->assertAllowedHttpMethod ($ this ->request , 'POST ' );
509
+ }
510
+
478
511
/**
479
512
* Attaches one backend user group to the compare list
480
513
*/
@@ -484,6 +517,11 @@ public function addGroupToCompareListAction(int $uid): ResponseInterface
484
517
return $ this ->redirect ('groups ' );
485
518
}
486
519
520
+ protected function initializeRemoveGroupFromCompareListAction (): void
521
+ {
522
+ $ this ->assertAllowedHttpMethod ($ this ->request , 'POST ' );
523
+ }
524
+
487
525
/**
488
526
* Removes given backend user group to the compare list
489
527
*/
@@ -496,6 +534,11 @@ public function removeGroupFromCompareListAction(int $uid, int $redirectToCompar
496
534
return $ this ->redirect ('groups ' );
497
535
}
498
536
537
+ protected function initializeRemoveAllGroupsFromCompareListAction (): void
538
+ {
539
+ $ this ->assertAllowedHttpMethod ($ this ->request , 'POST ' );
540
+ }
541
+
499
542
/**
500
543
* Removes all backend user groups from the compare list
501
544
*/
0 commit comments