81 refactor i uzupełnienie swaggera do metod auth#174
Open
Conversation
…t + move it to authentication section
MoonPrincess06
requested changes
Mar 17, 2026
MoonPrincess06
requested changes
Mar 22, 2026
…ttps://github.com/Solvro/backend-testownik into 81-refactor-i-uzupełnienie-swaggera-do-metod-auth
Member
|
@JanekDr co myślisz żeby zrobić helper |
Member
|
i pamiętaj też żeby dać |
Member
Author
Myśle ze to dobry pomysł i uszczupli lekko kod w metodach auth dla usosa i solvro |
Contributor
There was a problem hiding this comment.
Pull request overview
Refactors the authentication-related OAuth and OTP endpoints in users to improve DRF Spectacular (Swagger/OpenAPI) schema generation, while tightening redirect safety checks and documenting request/response variants.
Changes:
- Migrates Solvro/USOS OAuth endpoints from function-based views to DRF
APIView/adrfasync API views. - Expands
@extend_schemadocumentation across JWT, OAuth, and OTP endpoints (params, examples, and response codes). - Updates redirect safety logic and adds tests for DEBUG-dependent HTTP/HTTPS redirect handling; adds initial OAuth flow tests.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
users/views.py |
New class-based OAuth endpoints, enhanced schema docs, updated redirect safety logic, and public OTP views made explicitly unauthenticated. |
users/urls.py |
Routes updated to point to the new class-based OAuth views. |
users/tests/test_redirect_url.py |
Adds DEBUG=True/False coverage for HTTP vs HTTPS redirect acceptance. |
users/tests/test_oauth.py |
Adds tests asserting callback URL composition and a mocked Solvro authorize flow. |
Comments suppressed due to low confidence (1)
users/views.py:574
- Same
add_query_params+ view-name issue in the banned-userjwt=truebranch: ifredirect_urlis the default view name,redirect(add_query_params(...))can raiseNoReverseMatchand return 500 instead of redirecting with an error.
if request.GET.get("jwt", "false") == "true":
auth_params = {"error": "user_banned"}
if user.ban_reason:
auth_params["ban_reason"] = user.ban_reason
return redirect(add_query_params(redirect_url, auth_params))
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
APIView/AsyncAPIViewdla poprawnego generowania schematu. Wszelkie opcje redirect korzystają z parametryzacji docelowych widoków klasowych.@extend_schemaze szczegółowym wykazem rzucanych kodów błędów (200,302,400,401,403,404) dla każdej ścieżki JWT i OTP.authentication_classes = []do publicznych widoków OTP i LoginLinkView. Eliminacja błędnych response401 Unauthorizeddla starych sesji.Authenticationw dokumentacji.