Skip to content

Commit

Permalink
chore: Split ResetPassword from BasicUser #376
Browse files Browse the repository at this point in the history
  • Loading branch information
jpmckinney committed Aug 23, 2024
1 parent deed964 commit 9955163
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 5 deletions.
8 changes: 6 additions & 2 deletions app/parsers.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,12 @@
class BasicUser(BaseModel):
username: str
name: str | None = None
password: str | None = None
temp_password: str | None = None
password: str
temp_password: str


class ResetPassword(BaseModel):
username: str


class SetupMFA(BaseModel):
Expand Down
2 changes: 1 addition & 1 deletion app/routers/users.py
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ def me(
"/users/forgot-password",
)
def forgot_password(
payload: parsers.BasicUser,
payload: parsers.ResetPassword,
client: aws.Client = Depends(dependencies.get_aws_client),
) -> serializers.ResponseBase:
"""
Expand Down
2 changes: 1 addition & 1 deletion docs/_static/routes.csv
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ PUT,/users/setup-mfa,SetupMFA,ResponseBase,SetupMFAInput,IResponse
POST,/users/login,BasicUser,LoginResponse,LoginInput,ILoginResponse
GET,/users/logout,,ResponseBase,,IResponse
GET,/users/me,,UserResponse,,IUserResponse
POST,/users/forgot-password,BasicUser,ResponseBase,ResetPasswordInput,IResponse
POST,/users/forgot-password,ResetPassword,ResponseBase,ResetPasswordInput,IResponse
GET,/users/{user_id},user_id,models.User,id,IUser
GET,/users,"page, page_size, sort_field, sort_order",UserListResponse,PaginationInput,IUsersListResponse
PUT,/users/{user_id},models.User,models.UserWithLender,UpdateUserInput,IUser
Expand Down
2 changes: 1 addition & 1 deletion tests/routers/test_users.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def test_duplicate_user(client, admin_header, user_payload):


def test_login_invalid_username(client):
response = client.post("/users/login", json={"username": "nonexistent"})
response = client.post("/users/login", json={"username": "nonexistent", "password": "", "temp_password": ""})

assert response.status_code == status.HTTP_403_FORBIDDEN
assert response.json() == {"detail": _("Invalid username or password")}
Expand Down

0 comments on commit 9955163

Please sign in to comment.