diff options
author | Jeremy Benoist <j0k3r@users.noreply.github.com> | 2015-10-06 09:19:06 +0200 |
---|---|---|
committer | Jeremy Benoist <j0k3r@users.noreply.github.com> | 2015-10-06 09:19:06 +0200 |
commit | 16dabc326311f084d671be188c7941bbb3c341c9 (patch) | |
tree | 3210a7688ea2bfa1bff5fd0422b52adf570edcdc /src/Wallabag/CoreBundle/Form/Type/ForgotPasswordType.php | |
parent | fdef5f460524215d806e244e5546865f4b8e01df (diff) | |
parent | 8263e71192989dc0fd28a41ac22f9c5b32eb11c4 (diff) | |
download | wallabag-16dabc326311f084d671be188c7941bbb3c341c9.tar.gz wallabag-16dabc326311f084d671be188c7941bbb3c341c9.tar.zst wallabag-16dabc326311f084d671be188c7941bbb3c341c9.zip |
Merge pull request #1436 from wallabag/v2-register
Public registration & oAuth2 \o/
Diffstat (limited to 'src/Wallabag/CoreBundle/Form/Type/ForgotPasswordType.php')
-rw-r--r-- | src/Wallabag/CoreBundle/Form/Type/ForgotPasswordType.php | 54 |
1 files changed, 0 insertions, 54 deletions
diff --git a/src/Wallabag/CoreBundle/Form/Type/ForgotPasswordType.php b/src/Wallabag/CoreBundle/Form/Type/ForgotPasswordType.php deleted file mode 100644 index 9e95eb47..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('WallabagCoreBundle: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 | } | ||