e97e057e1089bf42305472057c29a737e2705ba9
[mobi/.git] /
1 <?php
2
3 /**
4  * BasesfGuardRequestForgotPasswordForm for requesting a forgot password email
5  *
6  * @package    sfDoctrineGuardPlugin
7  * @subpackage form
8  * @author     Jonathan H. Wage <jonwage@gmail.com>
9  * @version    SVN: $Id: BasesfGuardRequestForgotPasswordForm.class.php 23536 2009-11-02 21:41:21Z Kris.Wallsmith $
10  */
11 class BasesfGuardRequestForgotPasswordForm extends BaseForm
12 {
13   public function setup()
14   {
15     $this->widgetSchema['email_address'] = new sfWidgetFormInput();
16     $this->validatorSchema['email_address'] = new sfValidatorString();
17
18     $this->widgetSchema->setNameFormat('forgot_password[%s]');
19   }
20
21   public function isValid()
22   {
23     $valid = parent::isValid();
24     if ($valid)
25     {
26       $values = $this->getValues();
27       $this->user = Doctrine_Core::getTable('sfGuardUser')
28         ->createQuery('u')
29         ->where('u.email_address = ?', $values['email_address'])
30         ->fetchOne();
31
32       if ($this->user)
33       {
34         return true;
35       } else {
36         return false;
37       }
38     } else {
39       return false;
40     }
41   }
42 }