Skip to content

Commit

Permalink
管理者ログイン画面のID, PWの長さ制限をeccube.yamlの設定値にそろえる
Browse files Browse the repository at this point in the history
  • Loading branch information
kazuyoshikakihara committed Aug 24, 2022
1 parent b9883b7 commit b4ca351
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions src/Eccube/Form/Type/Admin/LoginType.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

namespace Eccube\Form\Type\Admin;

use Eccube\Common\EccubeConfig;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\PasswordType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
Expand All @@ -23,13 +24,21 @@

class LoginType extends AbstractType
{
/**
* @var EccubeConfig
*/
protected $eccubeConfig;

/**
* @var SessionInterface
*/
protected $session;

public function __construct(SessionInterface $session)
{
public function __construct(
EccubeConfig $eccubeConfig,
SessionInterface $session
) {
$this->eccubeConfig = $eccubeConfig;
$this->session = $session;
}

Expand All @@ -40,7 +49,7 @@ public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder->add('login_id', TextType::class, [
'attr' => [
'maxlength' => 50,
'maxlength' => $this->eccubeConfig['eccube_id_max_len'],
],
'constraints' => [
new Assert\NotBlank(),
Expand All @@ -49,7 +58,7 @@ public function buildForm(FormBuilderInterface $builder, array $options)
]);
$builder->add('password', PasswordType::class, [
'attr' => [
'maxlength' => 50,
'maxlength' => $this->eccubeConfig['eccube_password_max_len'],
],
'constraints' => [
new Assert\NotBlank(),
Expand Down

0 comments on commit b4ca351

Please sign in to comment.