Sha256: b13b0f770915673d931d650cd90afd61566cd281afcfa273505a0dab448f1c5f
Contents?: true
Size: 820 Bytes
Versions: 6
Compression:
Stored size: 820 Bytes
Contents
# frozen_string_literal: true require "active_support/concern" module Decidim # Tells/Extends time before inactivity warning or automatic logout. class TimeoutsController < Decidim::ApplicationController prepend_before_action :skip_timeout, only: :seconds_until_timeout def skip_timeout request.env["devise.skip_timeoutable"] = true end def seconds_until_timeout time_remaining = current_user ? ::Devise.timeout_in - (Time.current - Time.zone.at(user_session["last_request_at"])) : 0 respond_to do |format| format.json { render json: { seconds_remaining: time_remaining.to_i }, status: :ok } end end # If user wants to continue session after inactivity warning. def heartbeat respond_to do |format| format.js end end end end
Version data entries
6 entries across 6 versions & 1 rubygems