Skip to content

Conversation

@Temake
Copy link

@Temake Temake commented Mar 3, 2025

Change password request from put to post request

Description

This pull request updates the change password API route in api/v1/routes/auth.py to follow RESTful best practices. Previously, the route used PUT, which is intended for idempotent updates. However, changing a password is an action-based operation, making POST the more appropriate HTTP method.

Related Issue (Link to issue ticket)

#1238

Motivation and Context

The current PUT method is inconsistent with common REST API convention.

  • POST is preferred for actions like password changes, which are not idempotent.
  • POST signals to integrators that this is a special action, not a regular update.
  • This change also aligns with security best practices for sensitive operations like password changes.

How Has This Been Tested?

I wrote unit tests to automatically test the fix works as expected
I also tested it manually on postman and got the expected response

Screenshots (if appropriate - Postman, etc):

Types of changes

  • [ x] Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • [x ] My code follows the code style of this project.
  • [x ] My change requires a change to the documentation.
  • [ x] I have updated the documentation accordingly.
  • [ x] I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • [ x] All new and existing tests passed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant