Skip to content

feat(auth): gate repository responses on success field for all auth methods #17

@coderabbitai

Description

@coderabbitai

Summary

Currently, AuthRepositoryImpl methods (signIn, signUp, getCurrentUser, resendOtpCode) always return Result.success(...) when the API call completes without a HTTP-level error, without inspecting the success field on the response DTO.

If the backend returns HTTP 200 with success: false, the flow incorrectly advances as if the operation succeeded. Each method should gate on response.success and, when false, return Result.failure with an appropriate user-facing AuthFailure carrying response.message.

Note: This should be applied consistently across all auth repository methods once confirmed with the backend developer that the success field is reliably used.

Affected methods

  • AuthRepositoryImpl.signUp — does not check RegisterResponseDto.success
  • Potentially signIn and getCurrentUser depending on backend contract
  • AuthRepositoryImpl.resendOtpCode — does not check ResendVerificationCodeResponseDto.success or message

Acceptance criteria

  • All auth repository methods check response.success before returning Result.success(...)
  • When response.success == false, return Result.failure with an AuthFailure carrying response.message as the user-facing message
  • UnauthorizedAuthFailure continues to carry an empty message (silent redirect) per existing convention
  • Unit tests cover the success: false path for affected methods

References

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions