バージョン選択

フォーラム

メニュー

オンライン状況

49 人のユーザが現在オンラインです。 (29 人のユーザが フォーラム を参照しています。)
登録ユーザ: 1
ゲスト: 48
tattsu もっと...

サイト内検索

質問 > フロント機能 > 新規会員登録のRepeatedTypeを辞めたい

フロント機能

新規スレッドを追加する

フラット表示 前のトピック | 次のトピック
投稿者 スレッド
toku3
投稿日時: 2024/2/15 18:42
対応状況: −−−
新米
登録日: 2024/2/15
居住地:
投稿: 3
新規会員登録のRepeatedTypeを辞めたい
[EC-CUBE] eccube-4.2.3 新規
[レンタルサーバ] localhost
[OS] Windows 11 Pro
[PHP] PHP 8.1.25 (cli)
[データベース] Mysql8.0.35
[WEBサーバ] Apache/2.4.58
[ブラウザ] Google Chrome121.0.6167.185
[導入プラグインの有無] 無
[カスタマイズの有無]
<?php

namespace Customize\Form\Extension;

use Eccube\Common\EccubeConfig;
use Eccube\Form\Type\Front\EntryType;
use Eccube\Form\Type\Master\JobType;
use Eccube\Form\Validator\Email;
use Symfony\Component\Form\AbstractTypeExtension;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\Form\Extension\Core\DataTransformer\ValueToDuplicatesTransformer;
use Symfony\Component\Form\Extension\Core\Type\EmailType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\Component\Validator\Constraints as Assert;

class EntryFormExtension extends AbstractTypeExtension
{
public static function getExtendedTypes(): iterable
{
yield EntryType::class;
}

/**
* @var EccubeConfig
*/
protected $eccubeConfig;

/**
* EntryFormExtension constructor.
*
* @param EccubeConfig $eccubeConfig
*/
public function __construct(EccubeConfig $eccubeConfig)
{
$this->eccubeConfig = $eccubeConfig;
}

/**
* {@inheritdoc}
*/
public function buildForm(FormBuilderInterface $builder, array $options)
{
$this->typeChange($builder);
}

private function typeChange(FormBuilderInterface $builder)
{
$builder
->remove('email')
->add('email', EmailType::class, [
'required' => true,
'constraints' => [
new Assert\NotBlank(),
new Email(null, null, $this->eccubeConfig['eccube_rfc_email_check'] ? 'strict' : null),
],
'attr' => [
'placeholder' => 'common.mail_address_sample',
],
])
->remove('plain_password')
->add('plain_password', TextType::class, [
'required' => true,
'constraints' => [
new Assert\Length([
'min' => $this->eccubeConfig['eccube_password_min_len'],
'max' => $this->eccubeConfig['eccube_password_max_len'],
]),
new Assert\Regex([
'pattern' => $this->eccubeConfig['eccube_password_pattern'],
'message' => 'form_error.password_pattern_invalid',
]),
],
'attr' => [
'placeholder' => trans('common.password_sample', [
'%min%' => $this->eccubeConfig['eccube_password_min_len'],
'%max%' => $this->eccubeConfig['eccube_password_max_len'], ]),
],
]);
}
}
[現象]
ファイルをそのまま載せてすみません。
新規会員登録のメールアドレスとパスワードの入力を1回で済むように変更中です。

現在、Extensionを利用して
removeで一旦消して、addで新たに作り直してみました。

'email'だけの場合は、表示上うまく行っているようです。(登録の動作確認はしていません。)

ところが、'plain_password'で同じことをすると
「システムエラーが発生しました。大変お手数ですが、サイト管理者までご連絡ください。」
になってしまいます。

この考え方ではうまく行かないのか、別のファイルも変更する必要があるのか
何かアドバイスを頂けると幸いです。
フラット表示 前のトピック | 次のトピック


題名 投稿者 日時
 » 新規会員登録のRepeatedTypeを辞めたい toku3 2024/2/15 18:42
     Re: 新規会員登録のRepeatedTypeを辞めたい mcontact 2024/2/15 18:52
       Re: 新規会員登録のRepeatedTypeを辞めたい toku3 2024/2/15 20:06
         Re: 新規会員登録のRepeatedTypeを辞めたい tattsu 2024/2/15 20:40
           Re: 新規会員登録のRepeatedTypeを辞めたい toku3 2024/2/15 21:31

 



ログイン


EC-CUBE公式 Amazon Payプラグイン

統計情報

総メンバー数は89,137名です
総投稿数は110,042件です

投稿数ランキング

1
seasoft
7367
2
468
3217
3
AMUAMU
2712
4
nanasess
2314
5
umebius
2085
6
yuh
1819
7
h_tanaka
1650
8
red
1570
9
mcontact
1298
10
tsuji
958
11
fukap
907
12
shutta
835
13
tao_s
799
14 ramrun 789
15 karin 689
16 sumida 641
17
homan
633
18 DELIGHT 572
19
patapata
502
20
flealog
485


ネットショップの壺

EC-CUBEインテグレートパートナー

Copyright© EC-CUBE CO.,LTD. All Rights Reserved.