mirror of
https://github.com/wallabag/wallabag.git
synced 2024-11-26 19:11:07 +00:00
Cleanup
- remove unecessary routing for UserBundle - remove unused form type
This commit is contained in:
parent
0a878469d4
commit
4c5e544183
4 changed files with 1 additions and 94 deletions
|
@ -1,8 +1,3 @@
|
|||
wallabag_user:
|
||||
resource: "@WallabagUserBundle/Controller/"
|
||||
type: annotation
|
||||
prefix: /
|
||||
|
||||
wallabag_api:
|
||||
resource: "@WallabagApiBundle/Resources/config/routing.yml"
|
||||
prefix: /
|
||||
|
|
|
@ -18,6 +18,7 @@ security:
|
|||
oauth_token:
|
||||
pattern: ^/oauth/v2/token
|
||||
security: false
|
||||
|
||||
api:
|
||||
pattern: /api/.*
|
||||
fos_oauth: true
|
||||
|
|
|
@ -1,54 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace Wallabag\CoreBundle\Form\Type;
|
||||
|
||||
use Symfony\Component\Form\AbstractType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\Validator\Constraints;
|
||||
use Symfony\Component\Validator\ExecutionContextInterface;
|
||||
use Doctrine\Bundle\DoctrineBundle\Registry;
|
||||
|
||||
class ForgotPasswordType extends AbstractType
|
||||
{
|
||||
private $doctrine = null;
|
||||
|
||||
public function __construct(Registry $doctrine)
|
||||
{
|
||||
$this->doctrine = $doctrine;
|
||||
}
|
||||
|
||||
public function buildForm(FormBuilderInterface $builder, array $options)
|
||||
{
|
||||
$builder
|
||||
->add('email', 'email', array(
|
||||
'required' => true,
|
||||
'constraints' => array(
|
||||
new Constraints\Email(),
|
||||
new Constraints\NotBlank(),
|
||||
new Constraints\Callback(array(array($this, 'validateEmail'))),
|
||||
),
|
||||
))
|
||||
;
|
||||
}
|
||||
|
||||
public function getName()
|
||||
{
|
||||
return 'forgot_password';
|
||||
}
|
||||
|
||||
public function validateEmail($email, ExecutionContextInterface $context)
|
||||
{
|
||||
$user = $this->doctrine
|
||||
->getRepository('WallabagUserBundle:User')
|
||||
->findOneByEmail($email);
|
||||
|
||||
if (!$user) {
|
||||
$context->addViolationAt(
|
||||
'email',
|
||||
'No user found with this email',
|
||||
array(),
|
||||
$email
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,35 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace Wallabag\CoreBundle\Form\Type;
|
||||
|
||||
use Symfony\Component\Form\AbstractType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\Validator\Constraints;
|
||||
|
||||
class ResetPasswordType extends AbstractType
|
||||
{
|
||||
public function buildForm(FormBuilderInterface $builder, array $options)
|
||||
{
|
||||
$builder
|
||||
->add('new_password', 'repeated', array(
|
||||
'type' => 'password',
|
||||
'invalid_message' => 'The password fields must match.',
|
||||
'required' => true,
|
||||
'first_options' => array('label' => 'New password'),
|
||||
'second_options' => array('label' => 'Repeat new password'),
|
||||
'constraints' => array(
|
||||
new Constraints\Length(array(
|
||||
'min' => 8,
|
||||
'minMessage' => 'Password should by at least 8 chars long',
|
||||
)),
|
||||
new Constraints\NotBlank(),
|
||||
),
|
||||
))
|
||||
;
|
||||
}
|
||||
|
||||
public function getName()
|
||||
{
|
||||
return 'change_passwd';
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue