Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
generatePassword example
$this
->
View
(
)
->
assign
(
'success', true
)
;
}
/** * Create new user * * POST /api/users */
public
function
postAction
(
)
: void
{
if
(
!
$this
->
Request
(
)
->
getParam
(
'password'
)
)
{
$passwordPlain
= Random::
generatePassword
(
)
;
$this
->
Request
(
)
->
setPost
(
'password',
$passwordPlain
)
;
}
if
(
$this
->
Request
(
)
->
getParam
(
'apiKey'
)
&& \
strlen
(
$this
->
Request
(
)
->
getParam
(
'apiKey'
)
)
< 40
)
{
throw
new
CustomValidationException
(
'apiKey is too short. The minimal length is 40.'
)
;
}
$user
=
$this
->resource->
create
(
$this
->
Request
(
)
->
getPost
(
)
)
;
$location
=
$this
->apiBaseUrl . 'users/' .
$user
->
getId
(
)
;
$data
=
[