summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorAzul <azul@riseup.net>2017-10-16 15:46:07 +0200
committerAzul <azul@riseup.net>2017-10-16 15:47:39 +0200
commitaba11e35fa483ae72203854e323445e8330ed71b (patch)
treeb903a3f85193675596a611e396a3c0322d4b0302 /app
parent35b710c968d6e71e4d4210dbc2e00abc6f14f513 (diff)
fix: login error message with locale set
On a failed login the warden failure app gets called. Some of the params are changed accordingly but controller and action remain. set_locale would detect there was no locale in the path and thus attempt to redirect. However the params still belong to the previous request which was a POST to Api::SessionsController. This route does not respond to get requests and so it would trigger a 404 in production and a 500 in development. This commit prevents set_locale to act upon warden failure app controller calls by adding /new to the list of `NON_LOCALE_PATHS`. (The path is updated by warden to the name of the action called in the failure app). A test is included in this commit that tries to login with an invalid username, password combination and a german locale set. fixes #8805
Diffstat (limited to 'app')
-rw-r--r--app/controllers/application_controller.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb
index 1f37fea..d3cfc2b 100644
--- a/app/controllers/application_controller.rb
+++ b/app/controllers/application_controller.rb
@@ -99,7 +99,7 @@ class ApplicationController < ActionController::Base
#
# URL paths for which we don't enforce the locale as the prefix of the path.
#
- NON_LOCALE_PATHS = /^\/(assets|webfinger|.well-known|rails|key|[0-9]+)($|\/)/
+ NON_LOCALE_PATHS = /^\/(assets|webfinger|.well-known|rails|key|[0-9]+|new)($|\/)/
#
# For some requests, we ignore locale determination.