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

source: OpenPNE3/trunk/lib/validator/opAuthValidatorMemberConfigAndPassword.class.php @ 9809

Last change on this file since 9809 was 9809, checked in by ebihara, 11 years ago

fixed fatal error when undefined-member tries authentication

File size: 1.1 KB
Line 
1<?php
2
3/**
4 * opAuthValidatorMemberConfigAndPassword
5 *
6 * @package    OpenPNE
7 * @subpackage validator
8 * @author     Kousuke Ebihara <ebihara@tejimaya.com>
9 */
10class opAuthValidatorMemberConfigAndPassword extends opAuthValidatorMemberConfig
11{
12  /**
13   * @see opAuthValidatorMemberConfig
14   */
15  protected function configure($options = array(), $messages = array())
16  {
17    parent::configure($options, $messages);
18    $this->setMessage('invalid', 'ID or password is not a valid.');
19  }
20
21  /**
22   * @see opAuthValidatorMemberConfig
23   */
24  protected function doClean($values)
25  {
26    opActivateBehavior::disable();
27    $values = parent::doClean($values);
28
29    if (empty($values['member']) || !($values['member'] instanceof Member))
30    {
31      throw new sfValidatorError($this, 'invalid');
32      opActivateBehavior::enable();
33    }
34
35    $valid_password = MemberConfigPeer::retrieveByNameAndMemberId('password', $values['member']->getId())->getValue();
36    opActivateBehavior::enable();
37    if (md5($values['password']) !== $valid_password)
38    {
39      throw new sfValidatorError($this, 'invalid');
40    }
41
42    return $values;
43  }
44}
Note: See TracBrowser for help on using the repository browser.