Repository navigation
Conversation
Closes #1172 Users::RegistrationsController는 before_action :authenticate_user!로 password 액션을 막으려 했다. 그러나 Devise 컨트롤러 안의 authenticate_user!는 force 없이는 아무것도 하지 않는다 (`warden.authenticate! if !devise_controller? || opts.delete(:force)`). 그래서 세션이 없거나 만료된 사용자가 GET /account/password에 들어오면 resource가 nil로 남는다. 이어 PwdForm의 form_with(model: nil)이 ArgumentError를 내 500이 났다. edit·update·destroy는 Devise의 authenticate_scope!가 지켜 왔다. - 효과가 없던 authenticate_user!와 set_current_user_resource를 지운다. - Devise의 authenticate_scope!(force 인증 + resource 설정)를 password에도 건다. 같은 이름의 콜백을 다시 선언하면 Devise의 only 목록을 덮으므로 네 액션을 모두 적는다. - 요청 테스트: 비로그인 GET password → 로그인 페이지로 리다이렉트. 수정 전에는 같은 ArgumentError로 RED였다. 로그인 사용자 폼 렌더링 테스트는 기존 것을 유지했다. 검증: bin/rails test 1763 runs 0 failures, rspec 70 examples 0 failures, srb tc OK, rubocop OK, bin/rake quality 4/4 (line 82.16%, branch 64.47%, flog method 79.69, class 287.75). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013Hry66K6wzb2UhKgHmAjuR
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Closes #1172
원인
Users::RegistrationsController는before_action :authenticate_user!로password액션을 막으려 했습니다. 하지만 Devise 컨트롤러 안에서authenticate_user!는force: true없이 호출하면 아무것도 하지 않습니다(warden.authenticate! if !devise_controller? || opts.delete(:force)).그래서 세션이 없거나 만료된 사용자가
GET /account/password에 들어오면resource가 nil인 채로 렌더링으로 넘어갑니다. 이어서PwdForm의form_with(model: nil)이ArgumentError: Passed nil to the :model argument를 내 500이 됐습니다.edit·update·destroy는 Devise의authenticate_scope!가 막고 있어서 문제가 없었습니다.수정
authenticate_user!와set_current_user_resource를 지웠습니다.prepend_before_action :authenticate_scope!를password에도 걸었습니다. 이 콜백은 force 인증을 하고resource를 설정합니다.only목록을 덮어씁니다. 그래서 네 액션을 모두 적었습니다.password하나만 적어 봤을 때 나머지 액션 테스트 7개가 nil 오류로 실패해서 확인한 부분입니다.테스트
GET password→ 로그인 페이지로 리다이렉트. 수정 전에는 운영과 같은ArgumentError로 RED였습니다.검증
bin/rails test: 1763 runs, 0 failuresrspec: 70 examples, 0 failuressrb tc, rubocop: OKbin/rake quality: 4/4 (line 82.16%, branch 64.47%, flog method 79.69, class 287.75)운영 로그로 당시 요청이 비로그인 상태였는지는 확인하지 않았습니다. 코드상 nil
resource가 생기는 경로는 이 경우뿐입니다.🤖 Generated with Claude Code
https://claude.ai/code/session_013Hry66K6wzb2UhKgHmAjuR
Summary by CodeRabbit