@@ -244,11 +244,13 @@ public function loginAction(): ResponseInterface
244244 $ adapter ->setIdentity ($ data ['username ' ]);
245245 $ adapter ->setCredential ($ data ['password ' ]);
246246 $ authResult = $ this ->authenticationService ->authenticate ();
247- $ logAdmin = $ this ->adminService ->logAdminVisit ($ this ->getServerParams (), $ data ['username ' ]);
248247 if ($ authResult ->isValid ()) {
249248 $ identity = $ authResult ->getIdentity ();
250- $ logAdmin ->setLoginStatus (AdminLogin::LOGIN_SUCCESS );
251- $ this ->adminService ->getAdminRepository ()->saveAdminVisit ($ logAdmin );
249+ $ this ->adminService ->logAdminVisit (
250+ $ this ->getServerParams (),
251+ $ data ['username ' ],
252+ AdminLogin::LOGIN_SUCCESS
253+ );
252254 if ($ identity ->getStatus () === Admin::STATUS_INACTIVE ) {
253255 $ this ->authenticationService ->clearIdentity ();
254256 $ this ->messenger ->addError ('Admin is inactive ' , 'user-login ' );
@@ -260,8 +262,11 @@ public function loginAction(): ResponseInterface
260262
261263 return new RedirectResponse ($ this ->router ->generateUri ('dashboard ' ));
262264 } else {
263- $ logAdmin ->setLoginStatus (AdminLogin::LOGIN_FAIL );
264- $ this ->adminService ->getAdminRepository ()->saveAdminVisit ($ logAdmin );
265+ $ this ->adminService ->logAdminVisit (
266+ $ this ->getServerParams (),
267+ $ data ['username ' ],
268+ AdminLogin::LOGIN_FAIL
269+ );
265270 $ this ->messenger ->addData ('shouldRebind ' , true );
266271 $ this ->forms ->saveState ($ form );
267272 $ this ->messenger ->addError ($ authResult ->getMessages (), 'user-login ' );
0 commit comments