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

refactor(user): use single purpose token and auth to accept invite #4498

Merged
merged 1 commit into from
May 2, 2024

Conversation

apoorvdixit88
Copy link
Contributor

@apoorvdixit88 apoorvdixit88 commented Apr 29, 2024

Type of Change

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

Description

  • Use single purpose JWT auth and single purpose token for accept invite
  • Remove user without merchant JWT auth and user auth token

Additional Changes

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

Motivation and Context

closes #4497

How did you test it?

  • Enable email feature flag
  • Signup/ singin
  • Invite a new user from multiple accounts
  • Sign in to newly created user
  • The response should be merchant select, then do accept invite, it will give dashboard entry response.
Screenshot 2024-04-29 at 9 23 52 PM

Current and expected behaviour of accept invite should remain same!

curl --location 'http://localhost:8080/user/user/invite/accept' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer JWT' \
--data '{
    "merchant_ids": [
         "merchant_id1",
         "merchant_id2",
         "merchant_id3"
    ],
    "need_dashboard_entry_response": true
}'

If any of the merchant_id status is active, then you will be getting the following response.

{
    "token": "JWT with merchant_id, user_id, user_role",
    "merchant_id": "merchant_id",
    "name": "user name",
    "email": "user email",
    "verification_days_left": null,
    "user_role": "user role"
}

If need_dashboard_entry_response is false or not sent, then the response will be 200 OK.

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

@apoorvdixit88 apoorvdixit88 added S-waiting-on-review Status: This PR has been implemented and needs to be reviewed C-refactor Category: Refactor A-users Area: Users labels Apr 29, 2024
@apoorvdixit88 apoorvdixit88 self-assigned this Apr 29, 2024
@apoorvdixit88 apoorvdixit88 requested review from a team as code owners April 29, 2024 18:57
@apoorvdixit88 apoorvdixit88 changed the title feat(user): use single purpose token and auth to accept invite refactor(user): use single purpose token and auth to accept invite Apr 29, 2024
@Gnanasundari24 Gnanasundari24 added this pull request to the merge queue May 2, 2024
Merged via the queue into main with commit 4b0cf9c May 2, 2024
16 of 18 checks passed
@Gnanasundari24 Gnanasundari24 deleted the refactor-accept-invite-to-accept-spt-auth branch May 2, 2024 09:49
@SanchithHegde SanchithHegde removed the S-waiting-on-review Status: This PR has been implemented and needs to be reviewed label May 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-users Area: Users C-refactor Category: Refactor
Projects
None yet
Development

Successfully merging this pull request may close these issues.

refactor: use single purpose token and auth for accept invite
5 participants