Skip to content

Respect locale in FailureApp when handling an unconfirmed user #5812

@codener

Description

@codener

Hello there. I was debugging an issue and found this #5567. I believe this is related, and I found #5247 (comment) as well.

Background: We have recently turned our codebase from a two-locale application to a single-locale application. Further, the default locale is still :de, while the application is only available in :en. I know that should be aligned, but please bear with me – be believe this constellation exposes the issue.

My observation:

  1. I am trying to sign in in :en.
  2. Something "invisible" kills my request and redirects to the sign-in page – but in :de. That's wrong. There's nothing in the logs, the request does not even arrive in my controller action.
  3. I believe my request was killed by lib/devise/hooks/activatable.rb. I'm not sure how it got triggered, because my session#create action has not even been called. It must be some before action hook, but the app is complex.
  4. Its throw :warden ... gets caught by a Devise middleware, which invokes the FailureApp. When poking around there, a :locale is missing (as normally set in https://github.com/heartcombo/devise/pull/5567/files#diff-829736526e62456111dc08149318d7528bb478fabbda74ee6620e358833d8674R48).

I could patch this by overriding #i18n_locale in my already present custom failure app, but I believe this is an issue related to #5567 and should be fixed in Devise.

wdyt?

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions