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:
@@ -131,11 +131,11 @@ def _render_config_needed(request: Request, user: dict[str, Any]) -> HTMLRespons
|
||||
def _guard(request: Request):
|
||||
"""로그인+권한+store 점검. 페이지 핸들러 진입부에서 사용."""
|
||||
from app.main import get_current_user_record, render_template # noqa: WPS433
|
||||
from app.store import has_module, is_admin # noqa: WPS433
|
||||
from app.store import has_module, is_admin, login_redirect # noqa: WPS433
|
||||
|
||||
user = get_current_user_record(request)
|
||||
if user is None:
|
||||
return RedirectResponse(url="/login", status_code=303)
|
||||
return login_redirect(request)
|
||||
if not has_module(user, "dispatch"):
|
||||
return render_template(
|
||||
request,
|
||||
|
||||
Reference in New Issue
Block a user