Skip to content

Commit 9329456

Browse files
committed
fix(tc): redirect unauthenticated POST to login instead of crashing
1 parent 9be1774 commit 9329456

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

app/controllers/terms_and_conditions_controller.rb

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,13 @@ def show
1010
end
1111

1212
def update
13+
# The show action skips accept_terms, but unauthenticated users can still
14+
# POST directly to update. Redirect to login to avoid NoMethodError on nil.
15+
unless logged_in?
16+
redirect_to '/auth/github'
17+
return
18+
end
19+
1320
@terms_and_conditions_form = TermsAndConditionsForm.new(terms_params)
1421
if @terms_and_conditions_form.valid?
1522
member = current_user

0 commit comments

Comments
 (0)