diff --git a/Block/Adminhtml/Loginlog/Edit/Form.php b/Block/Adminhtml/Loginlog/Edit/Form.php index 80bf892..43110fa 100644 --- a/Block/Adminhtml/Loginlog/Edit/Form.php +++ b/Block/Adminhtml/Loginlog/Edit/Form.php @@ -87,10 +87,11 @@ protected function _prepareForm() 'name' => 'id', 'label' => __('ID'), ]); - $fieldset->addField('time', 'label', [ + $fieldset->addField('times', 'label', [ 'name' => 'time', 'label' => __('Time'), 'title' => __('Time'), + 'value' => $this->_helper->convertToLocaleTime($log->getTime()) ]); $fieldset->addField('user_name', 'label', [ 'name' => 'user_name', diff --git a/Helper/Data.php b/Helper/Data.php index 1b91317..21e6c11 100644 --- a/Helper/Data.php +++ b/Helper/Data.php @@ -21,6 +21,13 @@ namespace Mageplaza\Security\Helper; +use DateTime; +use DateTimeZone; +use Exception; +use Magento\Framework\App\Helper\Context; +use Magento\Framework\ObjectManagerInterface; +use Magento\Framework\Stdlib\DateTime\TimezoneInterface; +use Magento\Store\Model\StoreManagerInterface; use Mageplaza\Core\Helper\AbstractData; use Sinergi\BrowserDetector\Browser; use Sinergi\BrowserDetector\Os; @@ -46,6 +53,30 @@ class Data extends AbstractData */ protected $osLib; + /** + * @var TimezoneInterface + */ + protected $timezone; + + /** + * Data constructor. + * + * @param Context $context + * @param ObjectManagerInterface $objectManager + * @param StoreManagerInterface $storeManager + * @param TimezoneInterface $timezone + */ + public function __construct( + Context $context, + ObjectManagerInterface $objectManager, + StoreManagerInterface $storeManager, + TimezoneInterface $timezone + ) { + $this->timezone = $timezone; + + parent::__construct($context, $objectManager, $storeManager); + } + /** * Get Brute Force Config * @@ -160,4 +191,23 @@ public function isReports() return $this->isModuleOutputEnabled('Mageplaza_Reports') && $this->getConfigValue('mageplaza_reports/general/enabled'); } + + /** + * @param string $time + * @param string $format + * + * @return string + */ + public function convertToLocaleTime($time, $format = 'Y-m-d H:i:s') + { + try { + $localTime = new DateTime($time, new DateTimeZone('UTC')); + $localTime->setTimezone(new DateTimeZone($this->timezone->getConfigTimezone())); + $currentTime = $localTime->format($format); + } catch (Exception $e) { + $currentTime = ''; + } + + return $currentTime; + } } diff --git a/composer.json b/composer.json index 86c27d7..b2cef49 100644 --- a/composer.json +++ b/composer.json @@ -8,7 +8,7 @@ "sinergi/browser-detector": "*" }, "type": "magento2-module", - "version": "4.0.0", + "version": "4.0.1", "license": "proprietary", "authors": [ { diff --git a/view/adminhtml/templates/checklist/index.phtml b/view/adminhtml/templates/checklist/index.phtml index 5822af4..5b0a476 100644 --- a/view/adminhtml/templates/checklist/index.phtml +++ b/view/adminhtml/templates/checklist/index.phtml @@ -23,57 +23,57 @@ $unSecureNames = $block->checkAdminUserName(); ?>
- + escapeHtml(__("Check admin's username:")) ?>
-

-

+

escapeHtml(__('The following usernames are not secured: %1.', 'admin, root, test, magento')) ?>

+

escapeHtml(__('Hackers can guest username easily. Click on an user to change username.')) ?>

- - + +
- - + escapeHtml(__('Username: "%1" is not secure.', $unSecureName['username'])) ?> + escapeHtml(__('Fix it')) ?>
- + - + escapeHtml(__('All users are adequate for security purposes')) ?>
- + escapeHtml(__('Check captcha:')) ?>

- checkFrontendCaptcha()): ?> + checkFrontendCaptcha()) : ?> - - - + escapeHtml(__("Frontend captcha is not enabled. Hackers may carry out brute-force attacks on your customers' accounts")) ?> + escapeHtml(__('Fix it')) ?> + - + escapeHtml(__('Frontend captcha is enabled.')) ?>

- checkBackendCaptcha()): ?> + checkBackendCaptcha()) : ?>

- - + escapeHtml(__('Backend captcha is not enabled. To protect your backend from brute-force attacks, you should enable it.')) ?> + escapeHtml(__('Fix it')) ?>

- +

- + escapeHtml(__('Backend captcha is enabled.')) ?>

@@ -84,51 +84,51 @@ $isLatest = $version['latestVer'] == $version['currentVersion']; ?>
- + escapeHtml(__('Check Magento Version:')) ?>
- +
- - + escapeHtml(__('Your Magento version is: %1, the latest version is: %2', $version['currentVersion'], $version['latestVer'])) ?> + escapeHtml(__('Upgrade')) ?>
- + - + escapeHtml(__('Your store is running on the latest version.')) ?>
getDatabasePrefix() ?>
- + escapeHtml(__('Check database prefix:')) ?>
- + - - + escapeHtml(__("Your store's database is good.")) ?> +
- - - getDbFixitAdditionData() ?> + escapeHtml(__('Your store’s database hasn’t got table prefixes.')) ?> + escapeHtml(__('Fix it')) ?> + escapeHtml($block->getDbFixitAdditionData()) ?>
diff --git a/view/adminhtml/templates/dashboard/grid.phtml b/view/adminhtml/templates/dashboard/grid.phtml index 9518722..e76b5aa 100644 --- a/view/adminhtml/templates/dashboard/grid.phtml +++ b/view/adminhtml/templates/dashboard/grid.phtml @@ -21,8 +21,8 @@ $numColumns = count($block->getColumns()); ?> -getCollection()): ?> - isReports()): ?> +getCollection()) : ?> + isReports()) : ?>
-
+
escapeHtml(__('Login Log')) ?>
- getCollection()->getSize() > 0): ?> - + getCollection()->getSize() > 0) : ?> +
tags from the code. */ /* foreach ($block->getColumns() as $_column): ?> getHtmlProperty() ?> /> - getHeadersVisibility() || $block->getFilterVisibility()): ?> + getHeadersVisibility() || $block->getFilterVisibility()) : ?> - getHeadersVisibility()): ?> + getHeadersVisibility()) : ?> - getColumns() as $_column): ?> + getColumns() as $_column) : ?> getHeaderHtml() ?> - getIsCollapsed()): ?> + getIsCollapsed()) : ?> - getCollection() as $_index => $_item): ?> - + getCollection() as $_index => $_item) : ?> + getColumns() as $_column): ?> - @@ -69,8 +69,8 @@ $numColumns = count($block->getColumns());
- getRowField($_item) != '') ? $_column->getRowField($_item) : ' ' ?> + foreach ($block->getColumns() as $_column) : ?> + + getRowField($_item) != '') ? $block->escapeHtml($_column->getRowField($_item)) : ' ' ?>
- -
getEmptyText() ?>
+ +
escapeHtml($block->getEmptyText()) ?>
@@ -83,15 +83,15 @@ $numColumns = count($block->getColumns()); }) }); - canDisplayContainer()): ?> + canDisplayContainer()) : ?>