1919use Admin \App \Common \ServerRequestAwareTrait ;
2020use Admin \App \Exception \IdentityException ;
2121use Admin \App \Message ;
22+ use Admin \App \Pagination ;
2223use Admin \App \Plugin \FormsPlugin ;
24+ use Admin \Setting \Entity \Setting ;
25+ use Admin \Setting \Service \SettingService ;
2326use Doctrine \ORM \NonUniqueResultException ;
2427use Dot \Controller \AbstractActionController ;
2528use Dot \DependencyInjection \Attribute \Inject ;
@@ -52,7 +55,8 @@ class AdminController extends AbstractActionController
5255 FlashMessengerInterface::class,
5356 FormsPlugin::class,
5457 AdminForm::class,
55- "dot-log.default_logger "
58+ SettingService::class,
59+ "dot-log.default_logger " ,
5660 )]
5761 public function __construct (
5862 protected AdminServiceInterface $ adminService ,
@@ -62,7 +66,8 @@ public function __construct(
6266 protected FlashMessengerInterface $ messenger ,
6367 protected FormsPlugin $ forms ,
6468 protected AdminForm $ adminForm ,
65- protected Logger $ logger
69+ protected SettingService $ settingService ,
70+ protected Logger $ logger ,
6671 ) {
6772 }
6873
@@ -409,6 +414,48 @@ public function listLoginsAction(): ResponseInterface
409414 return new JsonResponse ($ result );
410415 }
411416
417+ public function simpleLoginsAction (): ResponseInterface
418+ {
419+ $ params = [
420+ 'offset ' => $ this ->getQueryParam ('offset ' , 0 , 'int ' ),
421+ 'limit ' => $ this ->getQueryParam ('limit ' , 10 , 'int ' ),
422+ 'sort ' => $ this ->getQueryParam ('sort ' , 'created ' ),
423+ 'order ' => $ this ->getQueryParam ('order ' , 'desc ' ),
424+ 'identity ' => $ this ->getQueryParam ('identity ' ),
425+ 'status ' => $ this ->getQueryParam ('status ' ),
426+ ];
427+
428+ $ logins = $ this ->adminService ->getAdminLogins (
429+ $ params ['offset ' ],
430+ $ params ['limit ' ],
431+ $ params ['sort ' ],
432+ $ params ['order ' ],
433+ [
434+ 'identity ' => $ params ['identity ' ],
435+ 'status ' => $ params ['status ' ],
436+ ]
437+ );
438+
439+ $ settings = $ this ->settingService ->findOneBy ([
440+ 'admin ' => $ this ->adminService ->getAdminRepository ()->findOneBy ([
441+ 'identity ' => $ this ->authenticationService ->getIdentity ()->getIdentity (),
442+ ]),
443+ 'identifier ' => Setting::IDENTIFIER_TABLE_ADMIN_LIST_LOGINS_SELECTED_COLUMNS ,
444+ ]);
445+
446+ return new HtmlResponse (
447+ $ this ->template ->render ('admin::simple-logins ' , [
448+ 'params ' => $ params ,
449+ 'logins ' => $ logins ['rows ' ],
450+ 'settings ' => $ settings ?->getValue() ?? [],
451+ 'statuses ' => [AdminLogin::LOGIN_FAIL , AdminLogin::LOGIN_SUCCESS ],
452+ 'identities ' => $ this ->adminService ->getAdminLoginIdentities (),
453+ 'identifier ' => Setting::IDENTIFIER_TABLE_ADMIN_LIST_LOGINS_SELECTED_COLUMNS ,
454+ 'pagination ' => new Pagination ($ logins ['total ' ], $ params ['offset ' ], $ params ['limit ' ]),
455+ ])
456+ );
457+ }
458+
412459 private function logErrors (Throwable $ e , string $ message ): void
413460 {
414461 $ this ->logger ->err ($ message , [
0 commit comments