English 中文(简体)
缩略语2:使用Doctrine2实体的奥特——在保留实体后将密码固定为空白价值
原标题:Symfony2: Auth using Doctrine2 entity - password set to blank value after saving an entity

I ve hit a dead end here. When I save any kind of entity in my controller, the password and salt of the user that is currently logged in is blanked out in the database.

这是我安全组合的一个相关部分:

security:
    encoders:
        ISELoginBundleEntityUser:
            algorithm: sha1
            iterations: 1
            encode_as_base64: false
    providers:
        main:
            entity:
                class: ISELoginBundleEntityUser
                property: username

这是我用户类别的变数方法。 我怀疑,在某个时候,这种方法被称作,然后通过这些改动将用户物体留给数据库。 但我对以下一点没有想法:

class User implements UserInterface {
    // ...
    public function eraseCredentials() {
        $this->password = null;
        $this->salt = null;
    }
    // ...
}

And this is an example of how I save an entity in one of my controllers, in this case it s the ProductController. Just a reminder: I am not manipulating the User object in my code in any way:

public function createAction() {
    // ...
    if ($form->isValid()) {
        $em = $this->get( doctrine )->getEntityManager();
        $em->persist($product);
        $em->flush();
        return $this->redirect($this->generateUrl( product_create , array( created  => true)));
    }
    // ...
}

我预计,该守则中的任何一项都不会删除数据库中的用户密码或盐类,但确实如此。 谁能帮助我把我的守则编成文件?

最佳回答

Symfony has a difference between plaintext and hashed credetials. In "eraseCredentials" you are supposed to delete all the plaintext information, not the hashed credetials that are saved to the database.

问题回答

暂无回答




相关问题
ajax login using httpRequest?

I am trying to develop my login script to give feedback to the user if the login is valid or not. Basically if it isn t correct a div box will show saying its wrong, if its correct it will show its ...

Remotely authenticating client Windows user on demand

Suppose I am writing a server for a particular network protocol. If I know that the client is running on a Windows machine, is it possible for my server to authenticate the Windows user that owns the ...

Role/Permission based forms authorizing/authentication?

While looking into forms authorizing/authentication, I found that it is possible to do role based authorizing by adding an array of roles to a FormsAuthenticationTicket. That way I can write User....

热门标签