バージョン選択

フォーラム

メニュー

オンライン状況

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

サイト内検索

質問 > フロント機能 > サブディレクトリインストール お気に入り登録ボタン⇒ログイン⇒ページが見つかりません

フロント機能

新規スレッドを追加する

フラット表示 前のトピック | 次のトピック
投稿者 スレッド
yamap
投稿日時: 2020/3/26 10:40
対応状況: −−−
新米
登録日: 2020/3/22
居住地:
投稿: 3
Re: サブディレクトリインストール お気に入り登録ボタン⇒ログイン⇒ページが見つかりません
開発環境ではサブディレクトリ、本番環境ではルートディレクトリとしているため、
ハードコーディングはなかなか厳しいです。。。
もう少し調べてみます。



ログイン失敗のパターンは、AbstractController:setLoginTargetPath()を参考に、
次のようなカスタムクラスを追加して試してみてうまく復元はできました。

リダイレクト先は相変わらずサブディレクトリですが。。。


<?php

/*
 * This file is part of EC-CUBE
 *
 * Copyright(c) EC-CUBE CO.,LTD. All Rights Reserved.
 *
 * http://www.ec-cube.co.jp/
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Customize\EventListener;

use Eccube\EventListener\SecurityListener;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Component\HttpFoundation\RequestStack;
use Symfony\Component\Security\Core\AuthenticationEvents;
use Symfony\Component\Security\Core\Event\AuthenticationFailureEvent;
use Symfony\Component\Security\Http\Event\InteractiveLoginEvent;
use Symfony\Component\Security\Http\SecurityEvents;

class CustomSecurityListener extends SecurityListener
{
    protected $requestStack;

    public function __construct(
        RequestStack $requestStack
    ) {
        $this->requestStack = $requestStack;
    }

    /**
     * @param AuthenticationFailureEvent $event
     */
    public function onAuthenticationFailure(AuthenticationFailureEvent $event)
    {
        $request = $this->requestStack->getCurrentRequest();
        $request->getSession()->set('_security.login_memory', (bool) $request->request->get('login_memory', 0));
        // リダイレクト先が指定されていれば復元
        $targetPath = $request->request->get('_target_path');
        if (!empty($targetPath)) {
            $request->getSession()->getFlashBag()->set('eccube.login.target.path', $targetPath);
        }
    }
}



AbstractController:setLoginTargetPath()では、

    /**
     * @param string $targetPath
     */
    public function setLoginTargetPath($targetPath, $namespace = null)
    {
        if (is_null($namespace)) {
            $this->session->getFlashBag()->set('eccube.login.target.path', $targetPath);
        } else {
            $this->session->getFlashBag()->set('eccube.'.$namespace.'.login.target.path', $targetPath);
        }
    }

となっており、$namespaceという引数で処理を分けているようなのですが、どのような利用を想定しているのかわかりませんが、
既存ソースからはそのような呼び出し方をしている個所は見当たりませんでしたので、とりあえず無視してみました。

もっといい方法があれば教えてください。
フラット表示 前のトピック | 次のトピック


題名 投稿者 日時
   サブディレクトリインストール お気に入り登録ボタン⇒ログイン⇒ページが見つかりません yamap 2020/3/22 16:19
     Re: サブディレクトリインストール お気に入り登録ボタン⇒ログイン⇒ページが見つかりません 468 2020/3/23 11:53
       Re: サブディレクトリインストール お気に入り登録ボタン⇒ログイン⇒ページが見つかりません yamap 2020/3/26 10:01
         Re: サブディレクトリインストール お気に入り登録ボタン⇒ログイン⇒ページが見つかりません 468 2020/3/26 10:22
         » Re: サブディレクトリインストール お気に入り登録ボタン⇒ログイン⇒ページが見つかりません yamap 2020/3/26 10:40

 



ログイン


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

統計情報

総メンバー数は88,865名です
総投稿数は109,998件です

投稿数ランキング

1
seasoft
7367
2
468
3217
3
AMUAMU
2712
4
nanasess
2313
5
umebius
2085
6
yuh
1819
7
h_tanaka
1646
8
red
1570
9
mcontact
1295
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.