- π§πͺBelgium wim leers Ghent π§πͺπͺπΊ
This is supported by JSON:API in core natively. See
\Drupal\Tests\jsonapi\Functional\UserTest::testPatchDxForSecuritySensitiveBaseFields()
. - Status changed to Needs review
over 1 year ago 9:35am 7 December 2023 - π§πͺBelgium wim leers Ghent π§πͺπͺπΊ
Let's wait for @mglaman to confirm π
- Status changed to Closed: works as designed
over 1 year ago 12:04pm 7 December 2023 - πΊπΈUnited States mglaman WI, USA
Yes this does seem to already work
// Test case 2: changing password. $normalization = Json::decode((string) $response->getBody()); $normalization['data']['attributes']['mail'] = 'new-email@example.com'; $new_password = $this->randomString(); $normalization['data']['attributes']['pass']['value'] = $new_password; $request_options[RequestOptions::BODY] = Json::encode($normalization); // DX: 422 when changing password without providing the current password. $response = $this->request('PATCH', $url, $request_options); $this->assertResourceErrorResponse(422, 'pass: Your current password is missing or incorrect; it\'s required to change the Password.', NULL, $response, '/data/attributes/pass'); $normalization['data']['attributes']['pass']['existing'] = $this->account->passRaw; $request_options[RequestOptions::BODY] = Json::encode($normalization); // 200 for well-formed request. $response = $this->request('PATCH', $url, $request_options); $this->assertResourceResponse(200, FALSE, $response);