Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
getPreviousToken example
public
function
onSuccessfulLogin
(
LoginSuccessEvent
$event
)
: void
{
$request
=
$event
->
getRequest
(
)
;
$token
=
$event
->
getAuthenticatedToken
(
)
;
if
(
!
$request
->
hasPreviousSession
(
)
)
{
return
;
}
if
(
$previousToken
=
$event
->
getPreviousToken
(
)
)
{
$user
=
$token
->
getUserIdentifier
(
)
;
$previousUser
=
$previousToken
->
getUserIdentifier
(
)
;
if
(
''
!==
(
$user
?? ''
)
&&
$user
===
$previousUser
)
{
return
;
}
}
$this
->sessionAuthenticationStrategy->
onAuthentication
(
$request
,
$token
)
;
}