ここの情報は古いです。ご理解頂いた上でお取り扱いください。

source: OpenPNE3/branches/goto_doctrine/lib/form/sfOpenPNEPasswordForm.class.php @ 11219

Last change on this file since 11219 was 11219, checked in by ebihara, 12 years ago

#3765:imported new models for Doctrine from some old models for Propel to enable to login

File size: 1.2 KB
Line 
1<?php
2
3/**
4 * This file is part of the OpenPNE package.
5 * (c) OpenPNE Project (http://www.openpne.jp/)
6 *
7 * For the full copyright and license information, please view the LICENSE
8 * file and the NOTICE file that were distributed with this source code.
9 */
10
11/**
12 * sfOpenPNEPassword form.
13 *
14 * @package    OpenPNE
15 * @subpackage form
16 * @author     Kousuke Ebihara <ebihara@tejimaya.com>
17 */
18class sfOpenPNEPasswordForm extends sfForm
19{
20  public function configure()
21  {
22    $this->setWidgets(array(
23      'password' => new sfWidgetFormInputPassword(),
24    ));
25
26    $this->setValidators(array(
27      'password' => new sfValidatorAnd(array(
28        new sfValidatorString(),
29        new sfValidatorCallback(array('callback' => array($this, 'isValidPassword')))
30      ))
31    ));
32
33    $this->widgetSchema->setNameFormat('password[%s]');
34  }
35
36  public function isValidPassword($validator, $value)
37  {
38    $member = $this->options['member'];
39    if (md5($value) !== Doctrine::getTable('MemberConfig')->retrieveByNameAndMemberId('password', $member->getId())->getValue())
40    {
41      throw new sfValidatorError(new sfValidatorPass(), 'invalid', array('value' => $value));
42    }
43
44    return $value;
45  }
46}
Note: See TracBrowser for help on using the repository browser.