Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Logout after password change #2486

Merged
merged 2 commits into from
Feb 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions app/controllers/catchall_controller.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
class CatchallController < ApplicationController
def not_implemented
return head :not_found if Rails.env.development?

interactor.call do |error|
return redirect_to error.location, status: error.status if error.redirect?
end
Expand Down
3 changes: 3 additions & 0 deletions config/initializers/devise.rb
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,9 @@
# Does not affect registerable.
# config.paranoid = true

# force accounts to signin again after changing password
config.sign_in_after_change_password = false

# By default Devise will store the user in session. You can skip storage for
# particular strategies by setting this option.
# Notice that if you are skipping storage for all authentication paths, you
Expand Down
4 changes: 3 additions & 1 deletion features/settings.feature
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,11 @@ Feature: Settings

Scenario: Updating password
Given I am signed in
And I sign in elsewhere
And I am on the settings page
And I update password to "new password"
Then I should see a successful update notification
And I will be logged out
And I will be logged out elsewhere

Scenario: Updating post code
Given I am signed in
Expand Down
11 changes: 11 additions & 0 deletions features/step_definitions/settings_steps.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,14 @@
Then(/^I see my settings page$/) do
expect(settings_page).to be_displayed
end

Then('I will be logged out') do
expect(sign_in_page).to be_displayed
end

Then('I will be logged out elsewhere') do
Capybara.using_session(:other_session) do
step 'I try to view the settings page'
step 'I will be logged out'
end
end
Loading