3

ユーザーが最後に正常に承認された時間を表示するために、zfc-userモジュール内で成功したログインをログに記録するにはどうすればよいですか?

zfcuserがイベントを使用しているのでリスナーを考えていますが、それを理解できません

4

2 に答える 2

3

上記の答えが残念ながら私を助けなかったところ、そして私がそれを耕し続けて解決したところ-さまざまなマイレージでの私の解決策はここにあります:

http://circlical.com/blog/2013/7/5/capturing-auth-events-with-zfcuser

それが別の魂を助けることを願っています。

于 2013-07-05T16:33:44.053 に答える
2

モジュールで作成された認証イベントがあり、これをフックできます(AdapterChainServiceFactory内の例を確認してください)

$chain = new AdapterChain;
$adapter = $serviceLocator->get('ZfcUser\Authentication\Adapter\Db');
$chain->getEventManager()->attach('authenticate', array($adapter, 'authenticate'));

イベントにフックして、認証が成功した場合は次のようにログを記録できます。

// Attach onto the event somewhere...
$chain->getEventManager()->attach('authenticate', array($myObject, 'logAuthenticate'));

// MyObject
public function logAuthenticate(AuthEvent $e)
{
    // logging magic here..
}
于 2013-01-25T10:36:59.523 に答える