开发者

sfDoctrineGuardPluggin rehashes the password from fixture after data-dump

I have s symfony 1.4 with Doctrine and sfDoctrineGuardPlugin.

I am experiencing a problem with loading fixtures for sfGuardUser which are made from symfony doctrine:data-dump

The core of the problem is that the passwords in the fixture file are not encrypted and they will be encrypted in the process of fixture loading.

In the other hand - when we dump data from the data base, the passwords are already encrypted and if we try to load them again, the value of the password will be rehashed for the second time.

Does anybody know how to avoid this situation?

I am using this process to prevent data loss when the model needs to be changed. If anybody knows other solution for this par开发者_Python百科ticular problem, I will appreciate!


There's a solution to this in the old symfony forum.

In short: create a setEncryptedPassword function in your user model like this:

  public function setEncryptedPassword($v)
  {
    if ($v !== null) {
        $v = (string) $v;
    }

    if ($this->password !== $v) {
        parent::_set('password', $v);
    }

    return $this;
  }

And in your dump change all password occurences to encrypted_password.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜