Does Zend\Authentication offer a way to check if an identity exists?

Its simple enough to use Zend\Authentication to authenticate against a DB:

$isAuthenticated = $this->getAuthService($db)->getAdapter()

But this just returns a Boolean value if authentication was successful. Does Zend\Authentication offer a way to check if the identity is present in a DB and return this info as well? I could just do an sql query first to see if its in the DB, but before I do that I wanted to be sure there wasn't an in box solution the class offered for this.

This way I could have an "Incorrect password please try again" message vs "User account does not exist" . Or I could just say that not displaying this info is a security feature and not bother :P


Yes, you have the code. And you can use as this:

// inside of AuthController / loginAction
$result = $this->auth->authenticate($adapter);

switch ($result->getCode()) {

    /** do stuff for nonexistent identity **/

    /** do stuff for invalid credential **/

case Result::SUCCESS:
    /** do stuff for successful authentication **/

    /** do stuff for other failure **/

Check the Authenticacion document

Need Your Help

Check All checkbox function inside a modal

javascript html angularjs checkbox modal-dialog

If user clicks 'add data' a modal opens, I have individual checkboxes for data1,data2,data3,data4. I also have a check all checkbox. If user clicks this, it should be able to select all above 4, if

persistence.xml not working

jpa persistence.xml

I have a problem with running a web project with JPA. Netbeans shows the message: