Skip to content

fix: refactor login.py for improved readability and logging enhancements - #6549

Merged
wxg0103 merged 1 commit into
v2from
pr@v2@fix_add_log
Jul 31, 2026
Merged

fix: refactor login.py for improved readability and logging enhancements#6549
wxg0103 merged 1 commit into
v2from
pr@v2@fix_add_log

Conversation

@shaohuzhang1

Copy link
Copy Markdown
Contributor

fix: refactor login.py for improved readability and logging enhancements

Copilot AI review requested due to automatic review settings July 31, 2026 01:24
@shaohuzhang1

Copy link
Copy Markdown
Contributor Author

Seems you are using me but didn't get OPENAI_API_KEY seted in Variables/Secrets for this repo. you could follow readme for more information

@wxg0103
wxg0103 merged commit 0c79334 into v2 Jul 31, 2026
5 of 7 checks passed
@wxg0103
wxg0103 deleted the pr@v2@fix_add_log branch July 31, 2026 01:24

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refactors apps/users/views/login.py with formatting changes and adds extra runtime logging in the login endpoint.

Changes:

  • Reformatted the module docstring, imports, and DRF extend_schema / @log decorators for readability.
  • Added an additional logger call in LoginView.post() to record scheme/HTTPS-related request metadata.
  • Compressed _get_details() into a single-line return structure (and altered quoting/style).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread apps/users/views/login.py
Comment on lines +3 to +7
@project: MaxKB
@Author:虎虎
@file: user.py
@date:2025/4/14 10:22
@desc:
Comment thread apps/users/views/login.py
Comment on lines +53 to +57
from common.utils.logger import maxkb_logger

maxkb_logger.info(
f"LoginView.post: request.scheme={request.scheme}, request.is_secure()={request.is_secure()}, request.META['wsgi.url_scheme']={request.META.get('wsgi.url_scheme')}, request.META['HTTPS']={request.META.get('HTTPS')}"
)
Comment thread apps/users/views/login.py
Comment on lines 26 to +30
def _get_details(request):
path = request.path
body = request.data
query = request.query_params
return {
'path': path,
'body': {**body, 'password': encryption(body.get('password', ''))},
'query': query
}
return {"path": path, "body": {**body, "password": encryption(body.get("password", ""))}, "query": query}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants