Skip to content

Instantly share code, notes, and snippets.

Created January 18, 2015 19:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/af583d45ebe6709e89e4 to your computer and use it in GitHub Desktop.
Save anonymous/af583d45ebe6709e89e4 to your computer and use it in GitHub Desktop.
class PustakController < ApplicationController
before_filter :session_expires, :except => [:login, :logout]
before_filter :update_session_time, :except => [:login, :logout]
def index
end
def session_expires
@time_left = (session[:expires_at] - Time.now).to_i
unless @time_left > 0
reset_session
redirect_to login_path
end
end
def update_session_time
session[:expires_at] = 10.seconds.from_now
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment