1
|
|
|
<?php |
2
|
|
|
/* |
3
|
|
|
* This file is part of EC-CUBE |
4
|
|
|
* |
5
|
|
|
* Copyright(c) 2000-2015 LOCKON CO.,LTD. All Rights Reserved. |
6
|
|
|
* |
7
|
|
|
* http://www.lockon.co.jp/ |
8
|
|
|
* |
9
|
|
|
* This program is free software; you can redistribute it and/or |
10
|
|
|
* modify it under the terms of the GNU General Public License |
11
|
|
|
* as published by the Free Software Foundation; either version 2 |
12
|
|
|
* of the License, or (at your option) any later version. |
13
|
|
|
* |
14
|
|
|
* This program is distributed in the hope that it will be useful, |
15
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
16
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
17
|
|
|
* GNU General Public License for more details. |
18
|
|
|
* |
19
|
|
|
* You should have received a copy of the GNU General Public License |
20
|
|
|
* along with this program; if not, write to the Free Software |
21
|
|
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
22
|
|
|
*/ |
23
|
|
|
|
24
|
|
|
|
25
|
|
|
namespace Eccube\Controller\Mypage; |
26
|
|
|
|
27
|
|
|
use Eccube\Application; |
28
|
|
|
use Eccube\Controller\AbstractController; |
29
|
|
|
use Eccube\Util\Str; |
30
|
|
|
use Eccube\Common\Constant; |
31
|
|
|
use Symfony\Component\HttpFoundation\Request; |
32
|
|
|
|
33
|
|
|
class WithdrawController extends AbstractController |
|
|
|
|
34
|
|
|
{ |
35
|
|
|
|
36
|
|
|
/** |
37
|
|
|
* Index |
38
|
|
|
* |
39
|
|
|
* @param Application $app |
40
|
|
|
* @param Request $request |
|
|
|
|
41
|
|
|
* @return \Symfony\Component\HttpFoundation\Response |
42
|
|
|
*/ |
43
|
3 |
|
public function index(Application $app, Request $request) |
44
|
|
|
{ |
45
|
|
|
/* @var $form \Symfony\Component\Form\FormInterface */ |
46
|
|
|
$form = $app->form()->getForm(); |
47
|
|
|
$form->handleRequest($request); |
48
|
|
|
|
49
|
|
|
if ($form->isSubmitted() && $form->isValid()) { |
50
|
2 |
|
switch ($request->get('mode')) { |
51
|
2 |
|
case 'confirm': |
52
|
1 |
|
return $app->renderView('Mypage/withdraw_confirm.twig', array( |
53
|
1 |
|
'form' => $form->createView(), |
54
|
|
|
)); |
55
|
|
|
|
56
|
1 |
|
case 'complete': |
57
|
|
|
/* @var $Customer \Eccube\Entity\Customer */ |
58
|
|
|
$Customer = $app->user(); |
59
|
|
|
|
60
|
|
|
// 会員削除 |
61
|
|
|
$email = $Customer->getEmail(); |
62
|
|
|
// メールアドレスにダミーをセット |
63
|
|
|
$Customer->setEmail(Str::random(60) . '@dummy.dummy'); |
|
|
|
|
64
|
|
|
$Customer->setDelFlg(Constant::ENABLED); |
65
|
|
|
|
66
|
|
|
$app['orm.em']->flush(); |
67
|
|
|
|
68
|
|
|
// メール送信 |
69
|
|
|
$app['eccube.service.mail']->sendCustomerWithdrawMail($Customer, $email); |
70
|
|
|
|
71
|
|
|
// ログアウト |
72
|
|
|
$this->getSecurity($app)->setToken(null); |
73
|
|
|
|
74
|
|
|
return $app->redirect($app->url('mypage_withdraw_complete')); |
75
|
|
|
} |
76
|
|
|
} |
77
|
|
|
|
78
|
1 |
|
return $app->renderView('Mypage/withdraw.twig', array( |
79
|
1 |
|
'form' => $form->createView(), |
80
|
|
|
)); |
81
|
3 |
|
} |
82
|
|
|
|
83
|
|
|
/** |
84
|
|
|
* Complete |
85
|
|
|
* |
86
|
|
|
* @param Application $app |
87
|
|
|
* @param Request $request |
|
|
|
|
88
|
|
|
* @return \Symfony\Component\HttpFoundation\Response |
89
|
|
|
*/ |
90
|
1 |
|
public function complete(Application $app, Request $request) |
|
|
|
|
91
|
|
|
{ |
92
|
|
|
return $app->renderView('Mypage/withdraw_complete.twig'); |
93
|
1 |
|
} |
94
|
|
|
} |
95
|
|
|
|