fix(공통): 로그인 후 보던 화면으로 복귀 + 깨진 users.json 덮어쓰기 방지

- app/store.py login_redirect(): 로그인 전 화면 주소를 /login?next= 로 넘긴다(GET 만 —
  폼 POST 주소로 돌아가면 405). 경비·쿠팡·휴가·말레이시아·배송·카페24·실적 11곳이
  next 없이 /login 으로 보내던 것과 프로젝트·입출고·안내문 발송의 복사본 4벌을 이 함수로.
- UserStore._read: JSONDecodeError 를 빈 목록으로 삼키지 않는다 — 다음 로그인이 전체
  사용자·권한을 그 한 명으로 덮어쓰던 것을 막는다.
- tests/test_login_redirect.py

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-30 10:45:58 +09:00
parent c9b4fa36fe
commit 007a16eb9c
12 changed files with 108 additions and 40 deletions
+2 -4
View File
@@ -68,13 +68,11 @@ def _user(request: Request) -> dict[str, Any]:
def _page_user(request: Request) -> Any:
"""화면 주소 — 로그인 전이면 로그인으로 보냈다가 돌아온다."""
from urllib.parse import quote # noqa: WPS433
from app.main import get_current_user_record # noqa: WPS433
from app.store import login_redirect # noqa: WPS433
if get_current_user_record(request) is None:
here = str(request.url.path) + ("?" + request.url.query if request.url.query else "")
return RedirectResponse(url="/login?next=" + quote(here, safe=""), status_code=303)
return login_redirect(request)
return _user(request)