diff --git a/src/Admin/src/Service/AdminLoginService.php b/src/Admin/src/Service/AdminLoginService.php
index 28588a4..66c6650 100644
--- a/src/Admin/src/Service/AdminLoginService.php
+++ b/src/Admin/src/Service/AdminLoginService.php
@@ -57,11 +57,7 @@ public function getAdminLogins(array $params): array
'login.osVersion',
'login.clientType',
'login.clientName',
- 'login.deviceBrand',
- 'login.deviceModel',
- 'login.osPlatform',
- 'login.clientEngine',
- 'login.clientVersion',
+ 'login.isCrawler',
'login.loginStatus',
'login.identity',
'login.created',
@@ -115,8 +111,7 @@ private function logAdminVisit(array $serverParams, string $name, SuccessFailure
*/
$browser = new stdClass();
if (ini_get('browscap')) {
- $result = get_browser($_SERVER['HTTP_USER_AGENT']);
- $browser = $result instanceof stdClass ? $result : $browser;
+ $browser = get_browser($_SERVER['HTTP_USER_AGENT']);
}
$adminLogin = (new AdminLogin())
@@ -133,11 +128,7 @@ private function logAdminVisit(array $serverParams, string $name, SuccessFailure
->setClientType(! empty($browser->browser_type) ? $browser->browser_type : null)
->setClientName(! empty($browser->browser) ? $browser->browser : null)
->setLoginStatus($status)
- ->setDeviceBrand(! empty($browser->device_brand) ? $browser->device_brand : null)
- ->setDeviceBrand(! empty($browser->device_model) ? $browser->device_model : null)
- ->setDeviceBrand(! empty($browser->platform_version) ? $browser->platform_version : null)
- ->setDeviceBrand(! empty($browser->browser_engine) ? $browser->browser_engine : null)
- ->setDeviceBrand(! empty($browser->browser_version) ? $browser->browser_version : null)
+ ->setIsCrawler(! empty($browser->crawler) ? YesNoEnum::Yes : YesNoEnum::No)
->setIdentity($name);
$this->adminLoginRepository->saveResource($adminLogin);
diff --git a/src/Admin/templates/admin/list-admin-login.html.twig b/src/Admin/templates/admin/list-admin-login.html.twig
index df59bff..cab7aa7 100644
--- a/src/Admin/templates/admin/list-admin-login.html.twig
+++ b/src/Admin/templates/admin/list-admin-login.html.twig
@@ -91,20 +91,8 @@
{{ sortableColumn('admin::list-admin-login', {}, pagination.queryParams, 'login.clientName', 'Client Name') }}
|
-
- {{ sortableColumn('admin::list-admin-login', {}, pagination.queryParams, 'login.deviceBrand', 'Device Brand') }}
- |
-
- {{ sortableColumn('admin::list-admin-login', {}, pagination.queryParams, 'login.deviceModel', 'Device Model') }}
- |
-
- {{ sortableColumn('admin::list-admin-login', {}, pagination.queryParams, 'login.osPlatform', 'Os Platform') }}
- |
-
- {{ sortableColumn('admin::list-admin-login', {}, pagination.queryParams, 'login.clientEngine', 'Client Engine') }}
- |
-
- {{ sortableColumn('admin::list-admin-login', {}, pagination.queryParams, 'login.clientVersion', 'Client Version') }}
+ |
+ {{ sortableColumn('admin::list-admin-login', {}, pagination.queryParams, 'login.isCrawler', 'Is Crawler') }}
|
{{ sortableColumn('admin::list-admin-login', {}, pagination.queryParams, 'login.created', 'Created') }}
@@ -138,11 +126,13 @@
| {{ login.osVersion }} |
{{ login.clientType }} |
{{ login.clientName }} |
- {{ login.deviceBrand }} |
- {{ login.deviceModel }} |
- {{ login.osPlatform }} |
- {{ login.clientEngine }} |
- {{ login.clientVersion }} |
+
+ {% if login.isCrawler.value == 'yes' %}
+ Yes
+ {% else %}
+ No
+ {% endif %}
+ |
{{ login.getCreated()|date('Y-m-d H:i:s') }} |
{% endfor %}
diff --git a/src/Core/src/Admin/src/Entity/AdminLogin.php b/src/Core/src/Admin/src/Entity/AdminLogin.php
index 1ced9af..aca1c9e 100644
--- a/src/Core/src/Admin/src/Entity/AdminLogin.php
+++ b/src/Core/src/Admin/src/Entity/AdminLogin.php
@@ -39,12 +39,6 @@ class AdminLogin extends AbstractEntity
#[ORM\Column(name: 'deviceType', type: 'string', length: 191, nullable: true)]
protected ?string $deviceType = null;
- #[ORM\Column(name: 'deviceBrand', type: 'string', length: 191, nullable: true)]
- protected ?string $deviceBrand = null;
-
- #[ORM\Column(name: 'deviceModel', type: 'string', length: 40, nullable: true)]
- protected ?string $deviceModel = null;
-
#[ORM\Column(type: 'yes_no_enum', nullable: true, enumType: YesNoEnum::class)]
protected YesNoEnum $isMobile = YesNoEnum::No;
@@ -54,20 +48,14 @@ class AdminLogin extends AbstractEntity
#[ORM\Column(name: 'osVersion', type: 'string', length: 191, nullable: true)]
protected ?string $osVersion = null;
- #[ORM\Column(name: 'osPlatform', type: 'string', length: 191, nullable: true)]
- protected ?string $osPlatform = null;
-
#[ORM\Column(name: 'clientType', type: 'string', length: 191, nullable: true)]
protected ?string $clientType = null;
#[ORM\Column(name: 'clientName', type: 'string', length: 191, nullable: true)]
protected ?string $clientName = null;
- #[ORM\Column(name: 'clientEngine', type: 'string', length: 191, nullable: true)]
- protected ?string $clientEngine = null;
-
- #[ORM\Column(name: 'clientVersion', type: 'string', length: 191, nullable: true)]
- protected ?string $clientVersion = null;
+ #[ORM\Column(type: 'yes_no_enum', nullable: true, enumType: YesNoEnum::class)]
+ protected YesNoEnum $isCrawler = YesNoEnum::No;
#[ORM\Column(type: 'success_failure_enum', nullable: true, enumType: SuccessFailureEnum::class)]
protected SuccessFailureEnum $loginStatus = SuccessFailureEnum::Fail;
@@ -144,30 +132,6 @@ public function setDeviceType(?string $deviceType): self
return $this;
}
- public function getDeviceBrand(): ?string
- {
- return $this->deviceBrand;
- }
-
- public function setDeviceBrand(?string $deviceBrand): self
- {
- $this->deviceBrand = $deviceBrand;
-
- return $this;
- }
-
- public function getDeviceModel(): ?string
- {
- return $this->deviceModel;
- }
-
- public function setDeviceModel(?string $deviceModel): self
- {
- $this->deviceModel = $deviceModel;
-
- return $this;
- }
-
public function getIsMobile(): ?YesNoEnum
{
return $this->isMobile;
@@ -204,18 +168,6 @@ public function setOsVersion(?string $osVersion): self
return $this;
}
- public function getOsPlatform(): ?string
- {
- return $this->osPlatform;
- }
-
- public function setOsPlatform(?string $osPlatform): self
- {
- $this->osPlatform = $osPlatform;
-
- return $this;
- }
-
public function getClientType(): ?string
{
return $this->clientType;
@@ -240,38 +192,26 @@ public function setClientName(?string $clientName): self
return $this;
}
- public function getClientEngine(): ?string
- {
- return $this->clientEngine;
- }
-
- public function setClientEngine(?string $clientEngine): self
- {
- $this->clientEngine = $clientEngine;
-
- return $this;
- }
-
- public function getClientVersion(): ?string
+ public function getLoginStatus(): ?SuccessFailureEnum
{
- return $this->clientVersion;
+ return $this->loginStatus;
}
- public function setClientVersion(?string $clientVersion): self
+ public function setLoginStatus(SuccessFailureEnum $loginStatus): self
{
- $this->clientVersion = $clientVersion;
+ $this->loginStatus = $loginStatus;
return $this;
}
- public function getLoginStatus(): ?SuccessFailureEnum
+ public function getIsCrawler(): ?YesNoEnum
{
- return $this->loginStatus;
+ return $this->isCrawler;
}
- public function setLoginStatus(SuccessFailureEnum $loginStatus): self
+ public function setIsCrawler(YesNoEnum $isCrawler): self
{
- $this->loginStatus = $loginStatus;
+ $this->isCrawler = $isCrawler;
return $this;
}
@@ -285,16 +225,12 @@ public function setLoginStatus(SuccessFailureEnum $loginStatus): self
* continent: string|null,
* organization: string|null,
* deviceType: string|null,
- * deviceBrand: string|null,
- * deviceModel: string|null,
* isMobile: string,
* osName: string|null,
* osVersion: string|null,
- * osPlatform: string|null,
* clientType: string|null,
* clientName: string|null,
- * clientEngine: string|null,
- * clientVersion: string|null,
+ * isCrawler: 'no'|'yes',
* loginStatus: string,
* created: DateTimeImmutable|null,
* updated: DateTimeImmutable|null,
@@ -303,26 +239,22 @@ public function setLoginStatus(SuccessFailureEnum $loginStatus): self
public function getArrayCopy(): array
{
return [
- 'id' => $this->id->toString(),
- 'identity' => $this->identity,
- 'adminIp' => $this->adminIp,
- 'country' => $this->country,
- 'continent' => $this->continent,
- 'organization' => $this->organization,
- 'deviceType' => $this->deviceType,
- 'deviceBrand' => $this->deviceBrand,
- 'deviceModel' => $this->deviceModel,
- 'isMobile' => $this->isMobile->value,
- 'osName' => $this->osName,
- 'osVersion' => $this->osVersion,
- 'osPlatform' => $this->osPlatform,
- 'clientType' => $this->clientType,
- 'clientName' => $this->clientName,
- 'clientEngine' => $this->clientEngine,
- 'clientVersion' => $this->clientVersion,
- 'loginStatus' => $this->loginStatus->value,
- 'created' => $this->created,
- 'updated' => $this->updated,
+ 'id' => $this->id->toString(),
+ 'identity' => $this->identity,
+ 'adminIp' => $this->adminIp,
+ 'country' => $this->country,
+ 'continent' => $this->continent,
+ 'organization' => $this->organization,
+ 'deviceType' => $this->deviceType,
+ 'isMobile' => $this->isMobile->value,
+ 'osName' => $this->osName,
+ 'osVersion' => $this->osVersion,
+ 'clientType' => $this->clientType,
+ 'clientName' => $this->clientName,
+ 'isCrawler' => $this->isCrawler->value,
+ 'loginStatus' => $this->loginStatus->value,
+ 'created' => $this->created,
+ 'updated' => $this->updated,
];
}
}
diff --git a/test/Unit/Admin/Entity/AdminLoginTest.php b/test/Unit/Admin/Entity/AdminLoginTest.php
index 5af37bc..3dfce8b 100644
--- a/test/Unit/Admin/Entity/AdminLoginTest.php
+++ b/test/Unit/Admin/Entity/AdminLoginTest.php
@@ -93,30 +93,11 @@ public function testAccessors(): void
$this->assertSame(AdminLogin::class, $adminLogin::class);
$this->assertSame('test', $adminLogin->getClientName());
- $this->assertNull($adminLogin->getDeviceBrand());
- $adminLogin = $adminLogin->setDeviceBrand('test');
+ $this->assertSame(YesNoEnum::No, $adminLogin->getIsCrawler());
+ $adminLogin = $adminLogin->setIsCrawler(YesNoEnum::Yes);
$this->assertSame(AdminLogin::class, $adminLogin::class);
- $this->assertSame('test', $adminLogin->getDeviceBrand());
-
- $this->assertNull($adminLogin->getDeviceModel());
- $adminLogin = $adminLogin->setDeviceModel('test');
- $this->assertSame(AdminLogin::class, $adminLogin::class);
- $this->assertSame('test', $adminLogin->getDeviceModel());
-
- $this->assertNull($adminLogin->getOsPlatform());
- $adminLogin = $adminLogin->setOsPlatform('test');
- $this->assertSame(AdminLogin::class, $adminLogin::class);
- $this->assertSame('test', $adminLogin->getOsPlatform());
-
- $this->assertNull($adminLogin->getClientEngine());
- $adminLogin = $adminLogin->setClientEngine('test');
- $this->assertSame(AdminLogin::class, $adminLogin::class);
- $this->assertSame('test', $adminLogin->getClientEngine());
-
- $this->assertNull($adminLogin->getClientVersion());
- $adminLogin = $adminLogin->setClientVersion('test');
- $this->assertSame(AdminLogin::class, $adminLogin::class);
- $this->assertSame('test', $adminLogin->getClientVersion());
+ $this->assertNotNull($adminLogin->getIsCrawler());
+ $this->assertSame('yes', $adminLogin->getIsCrawler()->value);
$this->assertSame(SuccessFailureEnum::Fail, $adminLogin->getLoginStatus());
$adminLogin = $adminLogin->setLoginStatus(SuccessFailureEnum::Success);