Skip to content
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
8 changes: 2 additions & 6 deletions app/controllers/users/sessions_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,14 @@ def destroy
def active
session[:pinged_at] = now
Rails.logger.debug(alive?: alive?, expires_at: expires_at)
render json: { live: alive?, timeout: expires_at, remaining: remaining_session_time }
render json: { live: alive?, timeout: expires_at }
end

def keepalive
session[:session_expires_at] = now + Devise.timeout_in if alive?
analytics.session_kept_alive if alive?

render json: { live: alive?, timeout: expires_at, remaining: remaining_session_time }
render json: { live: alive?, timeout: expires_at }
end

def timeout
Expand Down Expand Up @@ -152,10 +152,6 @@ def expires_at
session[:session_expires_at]&.to_datetime || (now - 1)
end

def remaining_session_time
expires_at.to_i - Time.zone.now.to_i
end

def browser_is_ie11?
BrowserCache.parse(request.user_agent).ie?(11)
end
Expand Down
36 changes: 0 additions & 36 deletions spec/controllers/users/sessions_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -50,15 +50,6 @@

expect(json['timeout'].to_datetime.to_i).to eq(timeout.to_i)
end

it 'includes the remaining key', freeze_time: true do
controller.session[:session_expires_at] = Time.zone.now + 10
get :active

json ||= JSON.parse(response.body)

expect(json['remaining']).to eq(10)
end
end

context 'when user is not present' do
Expand All @@ -78,14 +69,6 @@
expect(json['timeout'].to_datetime.to_i).to eq(Time.zone.now.to_i - 1)
end

it 'includes the remaining time', freeze_time: true do
get :active

json ||= JSON.parse(response.body)

expect(json['remaining']).to eq(-1)
end

it 'updates the pinged_at session key' do
stub_sign_in
now = Time.zone.now
Expand Down Expand Up @@ -721,17 +704,6 @@
)
end

it 'resets the remaining key' do
controller.session[:session_expires_at] = Time.zone.now + 10
post :keepalive

json ||= JSON.parse(response.body)

expect(json['remaining']).to be_within(1).of(
IdentityConfig.store.session_timeout_in_minutes * 60,
)
end

it 'tracks session refresh visit' do
controller.session[:session_expires_at] = Time.zone.now + 10
stub_analytics
Expand All @@ -758,14 +730,6 @@

expect(json['timeout'].to_datetime.to_i).to be_within(1).of(Time.zone.now.to_i - 1)
end

it 'includes the remaining time' do
post :keepalive

json ||= JSON.parse(response.body)

expect(json['remaining']).to eq(-1)
end
end

it 'does not track analytics event' do
Expand Down