Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(user): implement change password for user #2959

Merged
merged 11 commits into from
Nov 24, 2023

Conversation

apoorvdixit88
Copy link
Contributor

@apoorvdixit88 apoorvdixit88 commented Nov 23, 2023

Type of Change

  • Bugfix
  • New feature
  • Enhancement
  • Refactoring
  • Dependency updates
  • Documentation
  • CI/CD

Description

Added functionality for changing password for user. User the update their old passwords.

Additional Changes

  • This PR modifies the API contract
  • This PR modifies the database schema
  • This PR modifies application configuration/environment variables

Motivation and Context

There is no functionality to update password for user.

How did you test it?

Tested locally:

  • First do signup or signin to existing account
curl --location 'http://localhost:8080/user/v2/signin' \
--header 'Content-Type: application/json' \
--header 'Cookie: token=JWT' \
--data-raw '{
    "email": "newuser2@juspay.in",
    "password": "Test@12345"
    
}'

image

  • Call change password, pass old and new password in json body
curl --location 'http://localhost:8080/user/change_password' \
--header 'Content-Type: application/json' \
--header 'Cookie: token=JWT' \
--header 'Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoiM2JlZGViOTktNmI0My00ZGJmLTlhNjgtMWM0MDU1ODEzZDU1IiwibWVyY2hhbnRfaWQiOiJtZXJjaGFudF8xNzAwNzI2NDUzIiwicm9sZV9pZCI6Im9yZ19hZG1pbiIsImV4cCI6MTcwMDg5OTI1NCwib3JnX2lkIjoib3JnX3JEa3VYa09hTElRT1RISHBvYXRhIn0.1QWrzj4FSibTvi7jTU8cJSJjV5tk7Ns1vitl2qHSEYY' \
--data-raw '{
    "new_password": "Test@12345",
    "old_password": "Test@1406"
}
'
Screenshot 2023-11-23 at 1 42 52 PM
  • Again try to signin with new password
    Use the signin curl again.

Checklist

  • I formatted the code cargo +nightly fmt --all
  • I addressed lints thrown by cargo clippy
  • I reviewed the submitted code
  • I added unit tests for my changes where possible
  • I added a CHANGELOG entry if applicable

Comment on lines 80 to 88
Self::MerchantIdNotFound => {
AER::BadRequest(ApiError::new(sub_code, 18, "Invalid Merchant ID", None))
}
Self::InvalidOldPassword => AER::BadRequest(ApiError::new(
sub_code,
6,
"Old password incorrect. Please enter the correct password",
None,
)),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we fix this order

racnan
racnan previously approved these changes Nov 24, 2023
ThisIsMani
ThisIsMani previously approved these changes Nov 24, 2023
@SanchithHegde SanchithHegde added this pull request to the merge queue Nov 24, 2023
Merged via the queue into main with commit bfa1645 Nov 24, 2023
10 of 12 checks passed
@SanchithHegde SanchithHegde deleted the change-password-and-update-user-info branch November 24, 2023 15:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-users Area: Users
Projects
No open projects
Status: Merged
Development

Successfully merging this pull request may close these issues.

4 participants