(For Propel)
public function setPassword($password) { if (!$password && 0 == strlen($password)) { return; } /* * iba: if salt is set then probly the passwort is already encrpted * thus call setPassword without user_funx algorythm */ /*--- Add Here ---*/ $fromdump = false; if($this->isNew() && $this->getSalt()){ $fromdump=true; } /*----------------*/ if (!$salt = $this->getSalt()) { $salt = md5(rand(100000, 999999).$this->getUsername()); $this->setSalt($salt); } $algorithm = sfConfig::get('app_sf_guard_plugin_algorithm_callable', 'sha1'); $algorithmAsStr = is_array($algorithm) ? $algorithm[0].'::'.$algorithm[1] : $algorithm; if (!is_callable($algorithm)) { throw new sfException(sprintf('The algorithm callable "%s" is not callable.', $algorithmAsStr)); } $this->setAlgorithm($algorithmAsStr); /* * iba: if passwort is already encrypted dont encrypt it again. */ /*--- Add Here ---*/ if($fromdump){ parent::setPassword($password); } /*----------------*/ else{ parent::setPassword(call_user_func_array($algorithm, array($salt.$password))); } }
0 意見:
張貼留言