dtz8044 2015-11-09 14:57
浏览 47

在zend框架2中调用Db TableAu Adapter类中的过程

I am using the zend framework2 and make a try to login the user using the DbTableAuthAdapter class of zend framework2 as below

 $authAdapter=new DbTableAuthAdapter($dbAdapter,'login_user','username','password','is_active=1');

but instead of this i want to call a procedure like below

 $authAdapter=new DbTableAuthAdapter($dbAdapter,'CALL `sp_user_login`(?, ?)');

Is there anyway that i call procedure instead of binding the entity?

                          OR

Anyone tell me what is wrong in my below code

   use Zend\Authentication\Adapter\DbTable as AuthAdapter;
   $hashPassword=hash("sha256", $data["password"]);
   $subQuery="select zend_with_procedure.login_user.hash_salt from   zend_with_procedure.login_user where  zend_with_procedure.login_user.username='".$data['username']."'";

   $authAdapter=new AuthAdapter($dbAdapter,'login_user','username','password','concat('.$subQuery.','.$hashPassword.') AND is_active=1');

   $authAdapter->setIdentity($data['username']);
   $authAdapter->setCredential($data['password']);
   $auth=new AuthenticationService();
   $result=$auth->authenticate($authAdapter);

I am entering the correct username and password the it shows me invalid credentials why, Does anyone have the idea ???

  • 写回答

2条回答 默认 最新

  • dqch34769 2015-11-09 15:12
    关注

    I don't know which version of ZF2 you are using, but there seems to be a new CallbackCheckAdapter at least from version 2.2:

    http://framework.zend.com/apidoc/2.2/classes/Zend.Authentication.Adapter.DbTable.CallbackCheckAdapter.html

    Maybe using that one you can call the stored procedure?

    评论

报告相同问题?

悬赏问题

  • ¥15 制裁名单20240508芯片厂商
  • ¥20 易康econgnition精度验证
  • ¥15 msix packaging tool打包问题
  • ¥28 微信小程序开发页面布局没问题,真机调试的时候页面布局就乱了
  • ¥15 python的qt5界面
  • ¥15 无线电能传输系统MATLAB仿真问题
  • ¥50 如何用脚本实现输入法的热键设置
  • ¥20 我想使用一些网络协议或者部分协议也行,主要想实现类似于traceroute的一定步长内的路由拓扑功能
  • ¥30 深度学习,前后端连接
  • ¥15 孟德尔随机化结果不一致