Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
setEncoderName example
$customer
->
setActive
(
$customerConfirmed
)
;
if
(
!
$customerConfirmed
)
{
// Reset login information if Double-Opt-In is active
$customer
->
setFirstLogin
(
null
)
;
$customer
->
setLastLogin
(
null
)
;
$customer
->
setDoubleOptinEmailSentDate
(
new
DateTime
(
)
)
;
}
// Password validation
if
(
$customer
->
getPassword
(
)
)
{
$customer
->
setEncoderName
(
$this
->passwordManager->
getDefaultPasswordEncoderName
(
)
)
;
$customer
->
setPassword
(
$this
->passwordManager->
encodePassword
(
$customer
->
getPassword
(
)
,
$customer
->
getEncoderName
(
)
)
)
;
}
// Account mode validation
if
(
$error
->
getOrigin
(
)
instanceof FormInterface
)
{
$errors
[
'sErrorFlag'
]
[
$error
->
getOrigin
(
)
->
getName
(
)
]
= true;
}
$errors
[
'sErrorMessages'
]
[
]
=
$this
->
View
(
)
->
fetch
(
'string:' .
$error
->
getMessage
(
)
)
;
}
$this
->
View
(
)
->
assign
(
$errors
)
;
return
;
}
$customer
->
setEncoderName
(
$this
->
get
(
'passwordencoder'
)
->
getDefaultPasswordEncoderName
(
)
)
;
$this
->
get
(
'models'
)
->
persist
(
$customer
)
;
$this
->
get
(
'models'
)
->
flush
(
$customer
)
;
// Perform a login for customer and redirect to account
$this
->
Request
(
)
->
setPost
(
[
'email' =>
$customer
->
getEmail
(
)
, 'password' =>
$form
->
get
(
'password'
)
->
getData
(
)
]
)
;
$this
->admin->
sLogin
(
)
;
$target
=
$this
->
Request
(
)
->
getParam
(
'sTarget'
)
;
if
(
!
$target
)
{
$target
= 'account';
}