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
|
|
|
namespace Eccube\Form\Type\Admin; |
25
|
|
|
|
26
|
|
|
use Symfony\Component\Form\AbstractType; |
27
|
|
|
use Symfony\Component\Form\FormBuilderInterface; |
28
|
|
|
use Symfony\Component\Form\FormError; |
29
|
|
|
use Symfony\Component\Form\FormEvents; |
30
|
|
|
use Symfony\Component\OptionsResolver\OptionsResolverInterface; |
31
|
|
|
use Symfony\Component\Security\Core\Validator\Constraints\UserPassword; |
32
|
|
|
use Symfony\Component\Validator\Constraints as Assert; |
33
|
|
|
|
34
|
|
|
class ChangePasswordType extends AbstractType |
|
|
|
|
35
|
|
|
{ |
36
|
|
|
private $app; |
37
|
|
|
|
38
|
663 |
|
public function __construct($app) |
|
|
|
|
39
|
|
|
{ |
40
|
663 |
|
$this->app = $app; |
41
|
|
|
} |
42
|
|
|
|
43
|
|
|
/** |
44
|
|
|
* {@inheritdoc} |
45
|
|
|
*/ |
46
|
3 |
|
public function buildForm(FormBuilderInterface $builder, array $options) |
47
|
|
|
{ |
48
|
3 |
|
$app = $this->app; |
49
|
|
|
$builder |
50
|
3 |
|
->add('current_password', 'password', array( |
51
|
3 |
|
'label' => '現在のパスワード', |
52
|
|
|
'constraints' => array( |
53
|
3 |
|
new Assert\NotBlank(), |
54
|
3 |
|
new UserPassword(), |
55
|
|
|
), |
56
|
|
|
)) |
57
|
3 |
|
->add('change_password', 'repeated', array( |
58
|
|
|
'first_options' => array( |
59
|
|
|
'label' => '新しいパスワード', |
60
|
3 |
|
), |
61
|
|
|
'second_options' => array( |
62
|
|
|
'label' => '新しいパスワード(確認)', |
63
|
|
|
), |
64
|
|
|
'constraints' => array( |
65
|
3 |
|
new Assert\NotBlank(), |
66
|
3 |
|
new Assert\Length(array( |
67
|
3 |
|
'min' => $app['config']['password_min_len'], |
68
|
3 |
|
'max' => $app['config']['password_max_len'], |
69
|
|
|
)), |
70
|
3 |
|
new Assert\Regex(array( |
71
|
3 |
|
'pattern' => '/^[[:graph:][:space:]]+$/i', |
72
|
|
|
'message' => 'form.type.graph.invalid',
|
|
|
|
|
73
|
|
|
)), |
74
|
|
|
), |
75
|
|
|
)) |
76
|
3 |
|
->addEventSubscriber(new \Eccube\Event\FormEventSubscriber()); |
|
|
|
|
77
|
|
|
; |
78
|
|
|
} |
79
|
|
|
|
80
|
|
|
/** |
81
|
|
|
* {@inheritdoc} |
82
|
|
|
*/ |
83
|
|
|
public function setDefaultOptions(OptionsResolverInterface $resolver) |
84
|
|
|
{ |
85
|
|
|
} |
86
|
|
|
|
87
|
|
|
/** |
88
|
|
|
* {@inheritdoc} |
89
|
|
|
*/ |
90
|
663 |
|
public function getName() |
91
|
|
|
{ |
92
|
663 |
|
return 'admin_change_password'; |
93
|
|
|
} |
94
|
|
|
} |
95
|
|
|
|