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): add password validations #4489

Merged
merged 6 commits into from May 2, 2024
Merged

Conversation

Riddhiagrawal001
Copy link
Contributor

@Riddhiagrawal001 Riddhiagrawal001 commented Apr 29, 2024

Type of Change

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

Description

Closes #4412

Additional Changes

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

Motivation and Context

The mandatory condition for the password field was just not be empty . Following the PR, the password field will be subject to the following checks:
1.The password must be between 8 and 50 characters in length.
2.It must include at least one uppercase character.
3.It must include at least one lowercase character.
4.It must include at least one special character.
5.It must include at least one numeric character.

How did you test it?

  1. Signup API ( local testing)
curl --location 'http://localhost:8080/user/signup' \
--header 'Content-Type: application/json' \
--data-raw '{
    "email": "email value",
    "password": "456667sdvh",
    "country": "IN"
}'

Failure case response

{
    "error": {
        "type": "invalid_request",
        "message": "Invalid Password",
        "code": "UR_09"
    }
}
  1. Reset Password API (local testing)
curl --location 'http://localhost:8080/user/reset_password' \
--header 'Content-Type: application/json' \
--data '{
    "password": "456667sdvd",
    "token":"token from email after clicking Reset password in dashboard"
}'

Failure case response

{
    "error": {
        "type": "invalid_request",
        "message": "Invalid Password",
        "code": "UR_09"
    }
}

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

@Riddhiagrawal001 Riddhiagrawal001 added S-waiting-on-review Status: This PR has been implemented and needs to be reviewed A-users Area: Users labels Apr 29, 2024
@Riddhiagrawal001 Riddhiagrawal001 self-assigned this Apr 29, 2024
@Riddhiagrawal001 Riddhiagrawal001 requested a review from a team as a code owner April 29, 2024 11:12
@Riddhiagrawal001 Riddhiagrawal001 changed the title fix(users):add password validations fix(users): add password validations May 2, 2024
@Gnanasundari24 Gnanasundari24 added this pull request to the merge queue May 2, 2024
Merged via the queue into main with commit 67794da May 2, 2024
11 of 15 checks passed
@Gnanasundari24 Gnanasundari24 deleted the password-validations branch May 2, 2024 14:13
Riddhiagrawal001 added a commit that referenced this pull request May 3, 2024
ThisIsMani pushed a commit that referenced this pull request May 3, 2024
Riddhiagrawal001 added a commit that referenced this pull request May 3, 2024
@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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

BE Password specification
5 participants