diff --git a/app/controllers/users/sessions_controller.rb b/app/controllers/users/sessions_controller.rb index 5d3971a1854..65f59aa7e7c 100644 --- a/app/controllers/users/sessions_controller.rb +++ b/app/controllers/users/sessions_controller.rb @@ -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 @@ -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 diff --git a/spec/controllers/users/sessions_controller_spec.rb b/spec/controllers/users/sessions_controller_spec.rb index 0aa82d80071..6bcf286f36e 100644 --- a/spec/controllers/users/sessions_controller_spec.rb +++ b/spec/controllers/users/sessions_controller_spec.rb @@ -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 @@ -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 @@ -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 @@ -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