Munanshu Madaan
Munanshu Madaan

Reputation: 170

zend framework 2 authentication service check multiple conditions in credential treatment

I am using zf2 authentication service where in credential treatment i want to send several messages to user by checking some conditions as following:-

  1. If status is false then message as "you need admin permission to login".
  2. If email_confirmed is false Then take user to resend email link showing some message.
  3. If phone number is not confirmed then resend otp .

I am checking these fields in where condition of getDbSelect as

$authAdapter = new  AuthAdapter($DbAdapter,
                'admin',
                'username',
                'password', 
                "MD5(CONCAT('$salt', ?,'passhash'))"
                );
             $authAdapter->setIdentity($authform_data['username'])->setCredential($authform_data['password']);
             $auth = new AuthenticationService();
             $select = $authAdapter->getDbSelect();
             $select->where('status = 1 AND email_confirmed = 1 AND phone_confirmed = 1');
             $result = $auth->authenticate($authAdapter);
             print_r($result);die;

It only gives this message "A record with the supplied identity could not be found" if anyone of them is false but doesn't specify which field is true and which one is false . Is there any solution through which i could check these conditions individually and pass messages respectively. Thanks in Advance.

Upvotes: 0

Views: 302

Answers (0)

Related Questions