diff options
author | Jeremy Benoist <jeremy.benoist@gmail.com> | 2015-10-03 13:30:12 +0200 |
---|---|---|
committer | Jeremy Benoist <jeremy.benoist@gmail.com> | 2015-10-03 13:37:21 +0200 |
commit | 4c5e5441831430af2b8f49dbeb0c76da6993eceb (patch) | |
tree | 6007da21712c9f9b231df10d1b384db609ee24c6 | |
parent | 0a878469d4038c36c84d1dd707265d880fa342e8 (diff) | |
download | wallabag-4c5e5441831430af2b8f49dbeb0c76da6993eceb.tar.gz wallabag-4c5e5441831430af2b8f49dbeb0c76da6993eceb.tar.zst wallabag-4c5e5441831430af2b8f49dbeb0c76da6993eceb.zip |
Cleanup
- remove unecessary routing for UserBundle
- remove unused form type
-rw-r--r-- | app/config/routing.yml | 5 | ||||
-rw-r--r-- | app/config/security.yml | 1 | ||||
-rw-r--r-- | src/Wallabag/CoreBundle/Form/Type/ForgotPasswordType.php | 54 | ||||
-rw-r--r-- | src/Wallabag/CoreBundle/Form/Type/ResetPasswordType.php | 35 |
4 files changed, 1 insertions, 94 deletions
diff --git a/app/config/routing.yml b/app/config/routing.yml index f0f8f4b6..af3e32b1 100644 --- a/app/config/routing.yml +++ b/app/config/routing.yml | |||
@@ -1,8 +1,3 @@ | |||
1 | wallabag_user: | ||
2 | resource: "@WallabagUserBundle/Controller/" | ||
3 | type: annotation | ||
4 | prefix: / | ||
5 | |||
6 | wallabag_api: | 1 | wallabag_api: |
7 | resource: "@WallabagApiBundle/Resources/config/routing.yml" | 2 | resource: "@WallabagApiBundle/Resources/config/routing.yml" |
8 | prefix: / | 3 | prefix: / |
diff --git a/app/config/security.yml b/app/config/security.yml index d7d8c12b..576cfd25 100644 --- a/app/config/security.yml +++ b/app/config/security.yml | |||
@@ -18,6 +18,7 @@ security: | |||
18 | oauth_token: | 18 | oauth_token: |
19 | pattern: ^/oauth/v2/token | 19 | pattern: ^/oauth/v2/token |
20 | security: false | 20 | security: false |
21 | |||
21 | api: | 22 | api: |
22 | pattern: /api/.* | 23 | pattern: /api/.* |
23 | fos_oauth: true | 24 | fos_oauth: true |
diff --git a/src/Wallabag/CoreBundle/Form/Type/ForgotPasswordType.php b/src/Wallabag/CoreBundle/Form/Type/ForgotPasswordType.php deleted file mode 100644 index 5614d8b2..00000000 --- a/src/Wallabag/CoreBundle/Form/Type/ForgotPasswordType.php +++ /dev/null | |||
@@ -1,54 +0,0 @@ | |||
1 | <?php | ||
2 | |||
3 | namespace Wallabag\CoreBundle\Form\Type; | ||
4 | |||
5 | use Symfony\Component\Form\AbstractType; | ||
6 | use Symfony\Component\Form\FormBuilderInterface; | ||
7 | use Symfony\Component\Validator\Constraints; | ||
8 | use Symfony\Component\Validator\ExecutionContextInterface; | ||
9 | use Doctrine\Bundle\DoctrineBundle\Registry; | ||
10 | |||
11 | class ForgotPasswordType extends AbstractType | ||
12 | { | ||
13 | private $doctrine = null; | ||
14 | |||
15 | public function __construct(Registry $doctrine) | ||
16 | { | ||
17 | $this->doctrine = $doctrine; | ||
18 | } | ||
19 | |||
20 | public function buildForm(FormBuilderInterface $builder, array $options) | ||
21 | { | ||
22 | $builder | ||
23 | ->add('email', 'email', array( | ||
24 | 'required' => true, | ||
25 | 'constraints' => array( | ||
26 | new Constraints\Email(), | ||
27 | new Constraints\NotBlank(), | ||
28 | new Constraints\Callback(array(array($this, 'validateEmail'))), | ||
29 | ), | ||
30 | )) | ||
31 | ; | ||
32 | } | ||
33 | |||
34 | public function getName() | ||
35 | { | ||
36 | return 'forgot_password'; | ||
37 | } | ||
38 | |||
39 | public function validateEmail($email, ExecutionContextInterface $context) | ||
40 | { | ||
41 | $user = $this->doctrine | ||
42 | ->getRepository('WallabagUserBundle:User') | ||
43 | ->findOneByEmail($email); | ||
44 | |||
45 | if (!$user) { | ||
46 | $context->addViolationAt( | ||
47 | 'email', | ||
48 | 'No user found with this email', | ||
49 | array(), | ||
50 | |||
51 | ); | ||
52 | } | ||
53 | } | ||
54 | } | ||
diff --git a/src/Wallabag/CoreBundle/Form/Type/ResetPasswordType.php b/src/Wallabag/CoreBundle/Form/Type/ResetPasswordType.php deleted file mode 100644 index 38f1a105..00000000 --- a/src/Wallabag/CoreBundle/Form/Type/ResetPasswordType.php +++ /dev/null | |||
@@ -1,35 +0,0 @@ | |||
1 | <?php | ||
2 | |||
3 | namespace Wallabag\CoreBundle\Form\Type; | ||
4 | |||
5 | use Symfony\Component\Form\AbstractType; | ||
6 | use Symfony\Component\Form\FormBuilderInterface; | ||
7 | use Symfony\Component\Validator\Constraints; | ||
8 | |||
9 | class ResetPasswordType extends AbstractType | ||
10 | { | ||
11 | public function buildForm(FormBuilderInterface $builder, array $options) | ||
12 | { | ||
13 | $builder | ||
14 | ->add('new_password', 'repeated', array( | ||
15 | 'type' => 'password', | ||
16 | 'invalid_message' => 'The password fields must match.', | ||
17 | 'required' => true, | ||
18 | 'first_options' => array('label' => 'New password'), | ||
19 | 'second_options' => array('label' => 'Repeat new password'), | ||
20 | 'constraints' => array( | ||
21 | new Constraints\Length(array( | ||
22 | 'min' => 8, | ||
23 | 'minMessage' => 'Password should by at least 8 chars long', | ||
24 | )), | ||
25 | new Constraints\NotBlank(), | ||
26 | ), | ||
27 | )) | ||
28 | ; | ||
29 | } | ||
30 | |||
31 | public function getName() | ||
32 | { | ||
33 | return 'change_passwd'; | ||
34 | } | ||
35 | } | ||