session time out added to this module

This commit is contained in:
Harry Bomrah 2017-07-05 19:46:32 +08:00
parent 8692f0dd86
commit 2accb6c9aa
2 changed files with 10 additions and 1 deletions

View File

@ -4,12 +4,21 @@ class CUserController < ApplicationController
helper_method :current_counselor_user
def is_user_authorized?
dt = Time.now
session[:current_counselor_user_login_time] = Time.now if session[:current_counselor_user_login_time].nil?
dt1 = session[:current_counselor_user_login_time] + 20.minutes
if dt > dt1
redirect_to member_logout_path and return
else
session[:current_counselor_user_login_time] = Time.now
end
redirect_to member_login_path if current_counselor_user.nil?
end
def create_cuser_session(user=nil)
if !user.nil? and current_counselor_user.nil?
session[:current_counselor_user_id] = user.id
session[:current_counselor_user_login_time] = Time.now
end
end

View File

@ -1,6 +1,6 @@
class MemberCounselorsController < CUserController
before_filter :is_user_authorized?, :only => ["show"]
before_filter :is_user_authorized?, :only => ["show", "fileupload", "resultupload", "editfileupload", "editresultupload", "file_upload", "result_upload", "update_file_upload", "update_result_upload", "deletefileupload", "deleteresultupload", "newrecord", "new_record_upload", "editrecord", "update_record_upload", "deleterecord"]
def index
idx = 0