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

fix(users): Correct the condition for verify_email flow in decision manger #4580

Merged
merged 2 commits into from May 8, 2024

Conversation

ThisIsMani
Copy link
Contributor

Type of Change

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

Description

  • Currently decision manager is giving verify email flow for users who are already verified but not for users who are not verified. This should be other way around, so condition is negated.

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 #4579.

How did you test it?

As of now, this is only testable in local env. I've removed TOTP from decision manager and directly went to verify email flow.
Previously verify email flow is coming for only verified users, after this change it is coming for only non-verified users.

curl --location 'http://localhost:8080/user/from_email' \
--header 'Content-Type: application/json' \
--data '{
    "token": "email token"
}'

If the user didn't verify their email, then the token_type in the response should be verify_email.

{
    "token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoiMDYxNjE1YjAtZjI5Yi00NWIyLWJmNmItODczNTYyYWU1ODhlIiwicHVycG9zZSI6InRvdHAiLCJvcmlnaW4iOiJtYWdpY19saW5rIiwiZXhwIjoxNzE0ODExOTAwfQ.CDErXJ89a1o3ROyAKvm6TFW1drHDnlcqg43OoBQjY6A",
    "token_type": "verify_email"
}

If the user is already verified, then the user should get other flow which is not verify_email.

{
    "token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoiMDYxNjE1YjAtZjI5Yi00NWIyLWJmNmItODczNTYyYWU1ODhlIiwicHVycG9zZSI6InRvdHAiLCJvcmlnaW4iOiJtYWdpY19saW5rIiwiZXhwIjoxNzE0ODExOTAwfQ.CDErXJ89a1o3ROyAKvm6TFW1drHDnlcqg43OoBQjY6A",
    "token_type": "user_info"
}

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

@ThisIsMani ThisIsMani added C-bug Category: Bug A-users Area: Users labels May 8, 2024
@ThisIsMani ThisIsMani self-assigned this May 8, 2024
@ThisIsMani ThisIsMani requested a review from a team as a code owner May 8, 2024 07:09
@likhinbopanna likhinbopanna added this pull request to the merge queue May 8, 2024
Merged via the queue into main with commit 3db5b82 May 8, 2024
9 of 12 checks passed
@likhinbopanna likhinbopanna deleted the decision_manager_verify_fix branch May 8, 2024 08:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-users Area: Users C-bug Category: Bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

fix: verify email in decision manger
4 participants