EC-CUBE3.0.14
パスワードの再発行ができません。
調査していますが原因がわかりません。。
EC-CUBE本体はカスタマイズしていますが、パスワードまわりはカスタマイズしていません。
現象が発生する数日前にEC-CUBE3.0.13から3.0.14にアップデートしましたが、それ以前からこの現象が起こっていたかどうかはわかりません。
■再現手順
1. /forgot にてメールアドレスを入力し、次へ
2. 送信されたメールに記載のURL /forgot/reset/{reset_key} にアクセスし、新しいパスワードを発行
3. ログインページを表示し、送信されたメールに記載のパスワードにてログイン
→ログインできない
DBを確認したところ、パスワードが変更されていませんでした。
テストアカウントで試したところ、上記手順後に再発行前のパスワードでログインできたため、やはりパスワードが変更されていないようです。
src/Eccube/Controller/ForgotController.php をデバッグしたところ、ここではパスワードの変更処理は正常に動作しているように見受けられました。
public function reset(Application $app, Request $request, $reset_key)
{
$errors = $app['validator']->validateValue($reset_key, array(
new Assert\NotBlank(),
new Assert\Regex(array(
'pattern' => '/^[a-zA-Z0-9]+$/',
)))
);
if ('GET' === $request->getMethod()
&& count($errors) === 0) {
try {
$Customer = $app['eccube.repository.customer']
->getActiveCustomerByResetKey($reset_key);
} catch (\Exception $e) {
throw new HttpException\NotFoundHttpException('有効期限が切れているか、無効なURLです。');
}
dump($Customer->getPassword()); // ★ 暗号化された変更前のパスワードが出力された
// パスワードの発行・更新
$pass = $app['eccube.repository.customer']->getResetPassword();
$Customer->setPassword($pass);
// 発行したパスワードの暗号化
if ($Customer->getSalt() === null) {
$Customer->setSalt($app['eccube.repository.customer']->createSalt(5));
}
$encPass = $app['eccube.repository.customer']->encryptPassword($app, $Customer);
$Customer->setPassword($encPass);
dump($encPass); // ★ 暗号化された変更後のパスワードが出力された
$Customer->setResetKey(null);
// パスワードを更新
$app['orm.em']->persist($Customer);
$app['orm.em']->flush();
dump($Customer->getPassword()); // ★ 暗号化された変更後のパスワードが出力された
$event = new EventArgs(
array(
'Customer' => $Customer,
),
$request
);
$app['eccube.event.dispatcher']->dispatch(EccubeEvents::FRONT_FORGOT_RESET_COMPLETE, $event);
// メール送信
$app['eccube.service.mail']->sendPasswordResetCompleteMail($Customer, $pass);
// ログ出力
$app['monolog']->addInfo(
'reset password complete:' . "{$Customer->getId()} {$Customer->getEmail()} {$request->getClientIp()}"
);
} else {
throw new HttpException\AccessDeniedHttpException('不正なアクセスです。');
}
dump($Customer->getPassword()); // ★ 暗号化された変更後のパスワードが出力された
return $app->render('Forgot/reset.twig');
}
----------------
EC-CUBE 《プラチナ》ランクパートナー
トエビス株式会社 田中 宏典
EC-CUBEの機能やデザインのカスタマイズ承ります。