Skip to content

Commit

Permalink
Merge pull request #15 from okazy/umebius/admin/login_history
Browse files Browse the repository at this point in the history
管理画面ログイン履歴機能の微調整をしました
  • Loading branch information
dk-umebius authored Mar 23, 2021
2 parents c3c7123 + 17438a7 commit d6597c8
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 18 deletions.
4 changes: 2 additions & 2 deletions app/DoctrineMigrations/Version20210319122142.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ public function up(Schema $schema): void
{
$lang = env('ECCUBE_LOCALE');
$statuses = [
LoginHistoryStatus::FAILURE => $lang === 'ja' ? '失敗' : 'Failure',
LoginHistoryStatus::SUCCESS => $lang === 'ja' ? '成功' : 'Success',
LoginHistoryStatus::FAILURE => $lang === 'en' ? 'Failure' : '失敗',
LoginHistoryStatus::SUCCESS => $lang === 'en' ? 'Success' : '成功',
];

$sortNo = $this->connection->fetchColumn('SELECT MAX(sort_no) + 1 FROM mtb_login_history_status');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
use Eccube\Repository\LoginHistoryRepository;
use Eccube\Repository\Master\PageMaxRepository;
use Eccube\Util\FormUtil;
use Knp\Component\Pager\Paginator;
use Knp\Component\Pager\PaginatorInterface;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Routing\Annotation\Route;
Expand Down Expand Up @@ -61,7 +61,7 @@ public function __construct(
*
* @return \Symfony\Component\HttpFoundation\Response|array
*/
public function index(Request $request, Paginator $paginator, $page_no = null)
public function index(Request $request, PaginatorInterface $paginator, $page_no = null)
{
$session = $request->getSession();
$pageNo = $page_no;
Expand All @@ -85,7 +85,7 @@ public function index(Request $request, Paginator $paginator, $page_no = null)

if ('POST' === $request->getMethod()) {
$searchForm->handleRequest($request);
if ($searchForm->isValid()) {
if ($searchForm->isSubmitted() && $searchForm->isValid()) {
$searchData = $searchForm->getData();
$pageNo = 1;
$session->set('eccube.admin.login_history.search', FormUtil::getViewData($searchForm));
Expand Down
20 changes: 10 additions & 10 deletions src/Eccube/Entity/LoginHistory.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,13 @@ class LoginHistory extends AbstractEntity

/**
* @var string
* @ORM\Column( type="text",nullable=true)
* @ORM\Column(type="text",nullable=true)
*/
private $user_name;

/**
* @var string
* @ORM\Column( type="text",nullable=true)
* @ORM\Column(type="text",nullable=true)
*/
private $client_ip;

Expand Down Expand Up @@ -115,14 +115,6 @@ public function getUserName()
return $this->user_name;
}

/**
* @return LoginHistoryStatus
*/
public function getStatus()
{
return $this->Status;
}

/**
* @param LoginHistoryStatus $Status
*
Expand All @@ -135,6 +127,14 @@ public function setStatus($Status)
return $this;
}

/**
* @return LoginHistoryStatus
*/
public function getStatus()
{
return $this->Status;
}

/**
* Set client_ip
*
Expand Down
2 changes: 1 addition & 1 deletion src/Eccube/Entity/Master/LoginHistoryStatus.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

if (!class_exists(LoginHistoryStatus::class, false)) {
/**
* Work
* LoginHistoryStatus
*
* @ORM\Table(name="mtb_login_history_status")
* @ORM\InheritanceType("SINGLE_TABLE")
Expand Down
6 changes: 6 additions & 0 deletions src/Eccube/Form/Type/Admin/SearchLoginHistoryType.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,16 @@ public function buildForm(FormBuilderInterface $builder, array $options)
->add('user_name', TextType::class, [
'label' => 'admin.setting.system.login_history.user_name',
'required' => false,
'constraints' => [
new Assert\Length(['max' => $this->eccubeConfig['eccube_stext_len']]),
],
])
->add('client_ip', TextType::class, [
'label' => 'admin.setting.system.login_history.client_ip',
'required' => false,
'constraints' => [
new Assert\Length(['max' => $this->eccubeConfig['eccube_stext_len']]),
],
])
->add('Status', LoginHistoryStatusType::class, [
'label' => 'admin.setting.system.login_history.status',
Expand Down
2 changes: 1 addition & 1 deletion src/Eccube/Resource/locale/messages.en.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1245,7 +1245,7 @@ admin.setting.system.security__card_title: Security Settings
admin.setting.system.security.admin_url: Admin Console URL
admin.setting.system.security.admin_url_description: It is recommended to set the URL which would NOT be easily guessed.
admin.setting.system.security.admin_url_changed: The URL of Admin Console has been changed. Please sign in again.
admin.setting.system.security.ip_limit: IP Restrictions
admin.setting.system.security.ip_limit: IP Restrictions(Allow List)
admin.setting.system.security.ip_limit_description: |
This will restrict the access to the Admin Console to specified IP addresses.
Please enter the URLs one by one which you allow the access to. If no URLs are entered, any URL can access your Admin Console.
Expand Down
2 changes: 1 addition & 1 deletion src/Eccube/Resource/locale/messages.ja.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1245,7 +1245,7 @@ admin.setting.system.security__card_title: セキュリティ設定
admin.setting.system.security.admin_url: 管理画面URL
admin.setting.system.security.admin_url_description: 推測されにくいURLを設定することを推奨します。
admin.setting.system.security.admin_url_changed: 管理画面のURLを変更しました。再度ログインを行ってください。
admin.setting.system.security.ip_limit: IP制限
admin.setting.system.security.ip_limit: IP制限(許可リスト)
admin.setting.system.security.ip_limit_description: |
管理機能へのアクセスを特定のIPアドレスからの接続のみに制限します。
アクセスを許可するIPアドレスを1行ずつ入力してください。何も入力しない場合は全てを許可します。
Expand Down

0 comments on commit d6597c8

Please sign in to comment.