From 8c6d48da86c4c880044863610da5fdfb18b0e94c Mon Sep 17 00:00:00 2001 From: Patrick Gansterer Date: Mon, 31 Dec 2018 16:02:04 +0100 Subject: [PATCH] Avoid ActionView::MissingTemplate occurred in sessions#new Some browser request /:foodcoop/login with the HTTP-Accept-Header set to "image/webp,image/*;q=0.8", which leads to an internal server error due to a not existing template. Call respond_to to allow only html and respond with the correct "406 Not Acceptable" HTTP status code. --- app/controllers/sessions_controller.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/controllers/sessions_controller.rb b/app/controllers/sessions_controller.rb index 10d7a2c6..74bae0e7 100644 --- a/app/controllers/sessions_controller.rb +++ b/app/controllers/sessions_controller.rb @@ -2,8 +2,11 @@ class SessionsController < ApplicationController skip_before_filter :authenticate layout 'login' - + def new + respond_to do |format| + format.html + end end def create