aimeos / ai-client-jsonapi

Aimeos frontend JSON API
GNU Lesser General Public License v3.0
28 stars 6 forks source link

Front JsonApi Create Customer with Password #6

Closed exemplari closed 3 years ago

exemplari commented 3 years ago

Environment

  1. Version : 2020.10
  2. Operating system: linux ubuntu on docker

Describe the bug Per the docs the frontend jsonapi customer should be able to set the customer password on post. It does not. https://aimeos.org/docs/2020.x/frontend/jsonapi/customer/#create-new-customer

To Reproduce Steps to reproduce the behavior: Follow the docs to make a json post request of a user with a password.

Expected behavior A user should have the password set. Instead it generates the random password.

Screenshots na

Additional context I was able to solve this by replacing the frontend controller and modifying the "add" function. The password field gets unset down the line in the Customer Manager. To solve this i used the frontend controller to first grab the password, then apply it at the end. This seems to be what you attempted but the value gets unset if you do not store it first.

Also, In the documentation for configurations there is a mistake on "name" parameter. https://aimeos.org/docs/2020.x/config/controller-frontend/customer/#name It should be controller/frontend/customer/name = Mycustomer and not controller/jobs/frontend/customer/name = Mycustomer

aimeos commented 3 years ago

You mean something like this:

$password = $values['customer.password'] ?? '';
$item = $this->item->fromArray( $values );
...
if( $password ) {
    $item = $item->setPassword( $password );
}

controller/jobs/frontend/customer/name = Mycustomer

Thanks for the hint, this has been fixed.