Skip to content
Permalink
Browse files Browse the repository at this point in the history
Call invalidate_all_sessions in prepend_before_action
  • Loading branch information
julianguyen committed Feb 4, 2022
1 parent f5955c6 commit 014f6d3
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion app/controllers/sessions_controller.rb
Expand Up @@ -3,6 +3,7 @@
class SessionsController < Devise::SessionsController
prepend_before_action :check_recaptcha, only: [:create]
before_action :set_recaptcha, only: [:new]
prepend_before_action :invalidate_all_sessions, only: [:destroy]

def new
super
Expand All @@ -14,7 +15,6 @@ def create
end

def destroy
current_user.invalidate_all_sessions!
super
end

Expand Down Expand Up @@ -57,4 +57,8 @@ def recaptcha_required_for_user?

RecaptchaService.new(user).recaptcha_required_for_login?
end

def invalidate_all_sessions
current_user.invalidate_all_sessions!
end
end

0 comments on commit 014f6d3

Please sign in to comment.