Skip to content

Commit

Permalink
Clear the session to allow the ssytem user to be refreshed (#1156)
Browse files Browse the repository at this point in the history
  • Loading branch information
carolyncole authored Dec 19, 2024
1 parent 6a96114 commit bf1be32
Showing 1 changed file with 12 additions and 14 deletions.
26 changes: 12 additions & 14 deletions app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,32 +45,30 @@ def mediaflux_session_errors
raise unless e.is_a?(Mediaflux::SessionExpired) || e.cause.is_a?(Mediaflux::SessionExpired)
if session[:active_web_user]
redirect_to mediaflux_passthru_path(path: request.path)
elsif session_error_handler
retry
else
@retry_count ||= 0
@retry_count += 1

current_user.mediaflux_from_session(session)
if @retry_count < 3 # If the session is expired we should not have to retry more than once, but let's have a little wiggle room
retry
else
raise
end
raise
end
end

def mediaflux_login_errors
yield
rescue Mediaflux::SessionError
if session_error_handler
retry
else
raise
end
end

def session_error_handler
@retry_count ||= 0
@retry_count += 1

current_user.clear_mediaflux_session(session)
current_user.mediaflux_from_session(session)
if @retry_count < 3 # If the session is expired we should not have to retry more than once, but let's have a little wiggle room
retry
else
raise
end
@retry_count < 3 # If the session is expired we should not have to retry more than once, but let's have a little wiggle room
end

def emulate_user
Expand Down

0 comments on commit bf1be32

Please sign in to comment.