devise icon indicating copy to clipboard operation
devise copied to clipboard

Wrong flash message is rendered when signing out

Open MattBudz opened this issue 3 years ago • 1 comments

Environment

  • Ruby 3.0.3p157
  • Rails 7.0.4
  • Devise 4.8.1

Current behavior

When a signed-in user visits destroy_user_session_path the flash message is "You need to sign in before continuing." (en.devise.failure.unauthenticated)

For reference, the link is <%= link_to 'Sign out', destroy_user_session_path, data: { turbo_method: :delete } %>

Expected behavior

When a signed-in user visits destroy_user_session_path the flash message should be "Signed out successfully."(en.devise.sessions.signed_out)

MattBudz avatar Sep 11 '22 16:09 MattBudz

I fixed this by adding a sessions controller:

class SessionsController < Devise::SessionsController
  def destroy
    super do
      return redirect_to new_user_session_path, notice: I18n.t('devise.sessions.signed_out'), status: :see_other
    end
  end
end

MattBudz avatar Sep 11 '22 16:09 MattBudz

The main branch should contain all that's necessary for fully working with Turbo now, which should fix this. A new version will be released soon, but feel free to test it out from the main branch in the meantime, and report back on any issues. Thanks.

carlosantoniodasilva avatar Feb 09 '23 21:02 carlosantoniodasilva