This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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