There needs to be a way to reset the user password. The user.module has the following regular HTTP route

user.pass.http:
  path: '/user/password'
  defaults:
    _controller: \Drupal\user\Controller\UserAuthenticationController::resetPassword
  methods: [POST]
  requirements:
    _access: 'TRUE'
    _format: 'json'

Then the code is in \Drupal\user\Controller\UserAuthenticationController::resetPassword

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

mglaman created an issue. See original summary.

mglaman’s picture

Issue summary: View changes

mglaman’s picture

Status: Active » Needs review
FileSize
10.69 KB

Here's a patch. Thanks to gabesullice for support and ideas on the response

mglaman’s picture

??? this passed with flying colors locally on 8.8

mglaman’s picture

FileSize
11.3 KB

Here's a new try, with better assert messaging.

mglaman’s picture

FileSize
11.29 KB

Trying with cast to string due to stream problems. Maybe.

mglaman’s picture

+++ b/jsonapi_user_resources.routing.yml
@@ -6,3 +6,10 @@ jsonapi_user_resources.registration:
+jsonapi_user_resources.password_reset:
+  path: '/%jsonapi%/user/password'

From some feedback by gabesullice, I think this makes sense to be `/user/password/reset`.

In the future we may need `PATCH /user/password` for changing the current password.

mglaman’s picture

FileSize
11.29 KB

Change the path

  • mglaman committed 9854a3d on 8.x-1.x
    Issue #3106890 by mglaman, gabesullice: Password reset
    
mglaman’s picture

Status: Needs review » Fixed

🎊committed!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.