Eccube\Controller\EntryController::activate PHP Method

activate() public method

会員のアクティベート(本会員化)を行う.
public activate ( Application $app, Request $request, $secret_key ) : Response
$app Eccube\Application
$request Symfony\Component\HttpFoundation\Request
$secret_key
return Symfony\Component\HttpFoundation\Response
    public function activate(Application $app, Request $request, $secret_key)
    {
        $errors = $app['validator']->validateValue($secret_key, array(new Assert\NotBlank(), new Assert\Regex(array('pattern' => '/^[a-zA-Z0-9]+$/'))));
        if ($request->getMethod() === 'GET' && count($errors) === 0) {
            log_info('本会員登録開始');
            try {
                $Customer = $app['eccube.repository.customer']->getNonActiveCustomerBySecretKey($secret_key);
            } catch (\Exception $e) {
                throw new HttpException\NotFoundHttpException('※ 既に会員登録が完了しているか、無効なURLです。');
            }
            $CustomerStatus = $app['eccube.repository.customer_status']->find(CustomerStatus::ACTIVE);
            $Customer->setStatus($CustomerStatus);
            $app['orm.em']->persist($Customer);
            $app['orm.em']->flush();
            log_info('本会員登録完了');
            $event = new EventArgs(array('Customer' => $Customer), $request);
            $app['eccube.event.dispatcher']->dispatch(EccubeEvents::FRONT_ENTRY_ACTIVATE_COMPLETE, $event);
            // メール送信
            $app['eccube.service.mail']->sendCustomerCompleteMail($Customer);
            // 本会員登録してログイン状態にする
            $token = new UsernamePasswordToken($Customer, null, 'customer', array('ROLE_USER'));
            $this->getSecurity($app)->setToken($token);
            log_info('ログイン済に変更', array($app->user()->getId()));
            return $app->render('Entry/activate.twig');
        } else {
            throw new HttpException\AccessDeniedHttpException('不正なアクセスです。');
        }
    }