php - A value for the identity was not provided prior to authentication with Zend_Auth_Adapter_DbTable -
I'm getting the error when I started the logon authentication code. I am using Zend Framework End; Zend_Auth_Adapter_DbTable .
A value was not provided for authentication prior to authentication. What I've written:
public function authAction () {$ request = $ this-> GetRequest (); $ Registry = Zend_Registry :: getInstance (); $ Auth = Zend_Auth :: getInstance (); $ DB = $ Registry ['zenddb']; // zenddb is the name of the database $ authAdapter = new Zend_Auth_Adapter_DbTable ($ DB); $ AuthAdapter- & gt; SetTableName ('user'); $ AuthAdapter- & gt; SetIdentityColumn ('user_name'); $ AuthAdapter- & gt; SetCredentialColumn ('password'); // Set the input credential value $ uname = $ request- & gt; GetParam ('user_name'); $ Paswd = $ request- & gt; GetParam ('password'); $ AuthAdapter- & gt; SetIdentity ($ uname); $ AuthAdapter- & gt; SetCredential (md5 ($ paswd)); // Execute the authentication query, result $ result = $ auth- & gt; Authenticate ($ authAdapter); If ($ result-> is invalid ()) {$ data = $ authAdapter-> GetResultRowObject (empty, 'password'); $ Auth-> GetStorage () - & gt; ($ Data); $ This- & gt; _redirect ('userpage'); } And {$ this- & gt; _redirect ('Login'); }}
This error usually occurs when you empty the credential field in your form Skip,
The correction is done with a catch block which throws the error you told
You can solve it by entering a verification on the field related to the empty field Are there. Eg eg 'Required' = & gt; True
Hope it helps.
Comments
Post a Comment