Changeset 10116
- Timestamp:
- Jan 13, 2009, 6:23:07 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
OpenPNE3/trunk/lib/form/opAuthRegisterForm.class.php
r10111 r10116 52 52 53 53 parent::__construct($defaults, $options, $CSRFSecret); 54 55 $this->mergePostValidator(new sfValidatorCallback(array('callback' => array($this, 'validateMobileUID')))); 54 56 55 57 $this->widgetSchema->setNameFormat('auth[%s]'); … … 119 121 } 120 122 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 121 145 public function save() 122 146 { … … 130 154 if ($member && $profile && $auth && $config) 131 155 { 132 if ( opConfig::get('retrieve_uid'))156 if ($this->getValue('mobile_uid')) 133 157 { 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')); 139 159 } 160 140 161 return $this->getMember()->getId(); 141 162 }
Note: See TracChangeset
for help on using the changeset viewer.