Skip to content

Warden doesn't preserve locale when thrown #180

@JoeWoodward

Description

@JoeWoodward

We have been experiencing an issue where the wrong locale is being used for error messages returned from the Devise FailureApp, I believe it's due to the way that warden throws and catches.

The recommended way of setting the locale for a rails controller action is to use an around_action callback, e.g.

prepend_around_action :with_locale

def with_locale(action)
  I18n.with_locale(current_locale) { action }
end

When warden fails to authenticate it throws and calls a rack endpoint, the failure app... This means that the around_action is exited so the locale is no longer applied.

I don't see any way to tell warden to preserve the locale that was applied when the throw was called. Should warden do this internally?

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions