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

Changeset 10116


Ignore:
Timestamp:
Jan 13, 2009, 6:23:07 PM (14 years ago)
Author:
ebihara
Message:

#3313:changed auto registering a member's mobile UID for requiring it when a member registers from a mobile phone

File:
1 edited

Legend:

Unmodified
Added
Removed
  • OpenPNE3/trunk/lib/form/opAuthRegisterForm.class.php

    r10111 r10116  
    5252
    5353    parent::__construct($defaults, $options, $CSRFSecret);
     54
     55    $this->mergePostValidator(new sfValidatorCallback(array('callback' => array($this, 'validateMobileUID'))));
    5456
    5557    $this->widgetSchema->setNameFormat('auth[%s]');
     
    119121  }
    120122
     123  public function validateMobileUID($validator, $values, $arguments = array())
     124  {
     125    if (!opConfig::get('retrieve_uid'))
     126    {
     127      return $values;
     128    }
     129
     130    if (sfConfig::get('app_is_mobile', false))
     131    {
     132      $request = sfContext::getInstance()->getRequest();
     133      $uid = $request->getMobileUID();
     134      if (!$uid && opConfig::get('retrieve_uid') >= 2)
     135      {
     136        throw new sfValidatorError($validator, 'A mobile UID is required. Please check settings of your mobile phone and retry.');
     137      }
     138
     139      $values['mobile_uid'] = $uid;
     140    }
     141
     142    return $values;
     143  }
     144
    121145  public function save()
    122146  {
     
    130154    if ($member && $profile && $auth && $config)
    131155    {
    132       if (opConfig::get('retrieve_uid'))
     156      if ($this->getValue('mobile_uid'))
    133157      {
    134         $request = sfContext::getInstance()->getRequest();
    135         if (sfConfig::get('app_is_mobile', false))
    136         {
    137           $this->getMember()->setConfig('mobile_uid', $request->getMobileUID());
    138         }
     158        $this->getMember()->setConfig('mobile_uid', $this->getValue('mobile_uid'));
    139159      }
     160
    140161      return $this->getMember()->getId();
    141162    }
Note: See TracChangeset for help on using the changeset viewer.