php - Zf2 + Doctrine 2 Authentication Adapter restrict to fetch delete flag is equal to true row -


I have a problem, delete the table in my account is the flag column so if I delete a user, then it is 1 Will be set as. And I can make new users with the same mail id. At that time the code fails, there are two records with the same mail id. There is also a way to delete flag like email, my module Config.php:

  'Principle' = & gt; Array ('driver' = & gt; array (__NAMESPACE__ '_driver' = & gt; array ('class' = & gt; 'principle \ ORM \ mapping \ driver \ lecture driver', 'cache' => Array ',' path '= & gt; array (__DIR__.' /../src/ '__NAMESPACE__.' / Entity ')),' orm_default '= & gt; array (' driver '= & gt; array _nameSPACE__ '' unit = '_deSPACE__.' _driver '))),' authentication '=> array (' orm_default '= & gt; array (' object_manager '= & gt;' principle \ ORM 'unit Manager ',' identity-class '= & gt;' authentication 'unit' account ',' identity_procory '= & gt;' email ',' credential_property '= & gt;' password ',' no. Dynamic_colableable = '> function (account $ account, $ passwordGiven) {$ userPassword = New UserPassword (); $ res = $ UserPassword- & gt; Verify ($ account-> getPassword (), $ passwordGiven) ; $ Ridge & amp;! $ Account- & gt; GetDialy Flag () & amp; amp; $ account- & gt; getStatus ();},),))  

I do not know that it works on ZF2, I am currently working with ZF1, but I had a similar problem.

The solution was to write a custom author adapter, this class applies Zend_Auth_Adapter_Interface and the certified method is required. In my implementation of

Authenticate > I use a flag plus username and password < / Strong>.

Therefore, when I have to check a user:

  $ authAdapter = new MyAuthAdapter (); // I just need to set these values ​​because the flag is always considered incorrect so that user $ authAdapter-> Set credentials ($ password) - & gt; SetIdentity ($ username); // -> SettleFlag ($ yourFlag) You can use this Zend_Auth :: implementation () - & gt; Can authenticate ($ authAdapter) - & gt; IsValid ();  

Hope it helps since being on ZF1.


Comments

Popular posts from this blog

java - Can't add JTree to JPanel of a JInternalFrame -

javascript - data.match(var) not working it seems -

javascript - How can I pause a jQuery .each() loop, while waiting for user input? -