mirror of
https://github.com/internetee/registry.git
synced 2025-05-29 17:10:08 +02:00
Include explicit Depp ApplicationHelper
This commit is contained in:
parent
aad7cbef39
commit
8e1648772d
1 changed files with 2 additions and 18 deletions
|
@ -2,7 +2,7 @@ module Depp
|
||||||
# class ApplicationController < ::ApplicationController
|
# class ApplicationController < ::ApplicationController
|
||||||
class ApplicationController < ActionController::Base
|
class ApplicationController < ActionController::Base
|
||||||
include CurrentUserHelper
|
include CurrentUserHelper
|
||||||
include ApplicationHelper
|
include Depp::ApplicationHelper
|
||||||
|
|
||||||
# Prevent CSRF attacks by raising an exception.
|
# Prevent CSRF attacks by raising an exception.
|
||||||
# For APIs, you may want to use :null_session instead.
|
# For APIs, you may want to use :null_session instead.
|
||||||
|
@ -16,23 +16,7 @@ module Depp
|
||||||
|
|
||||||
before_action :authenticate_user
|
before_action :authenticate_user
|
||||||
def authenticate_user
|
def authenticate_user
|
||||||
if ENV['session_timeout']
|
redirect_to main_app.login_url and return unless depp_current_user
|
||||||
redirect_to main_app.login_url and return unless depp_current_user && session[:last_seen]
|
|
||||||
|
|
||||||
if (session[:last_seen].to_i + ENV['session_timeout'].to_i) < Time.now.to_i
|
|
||||||
session_timeout
|
|
||||||
else
|
|
||||||
session[:last_seen] = Time.now.to_i
|
|
||||||
end
|
|
||||||
else
|
|
||||||
redirect_to main_app.login_url and return unless depp_current_user
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def session_timeout
|
|
||||||
reset_session
|
|
||||||
flash[:alert] = t('your_session_has_timed_out')
|
|
||||||
redirect_to main_app.login_url and return
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def depp_current_user
|
def depp_current_user
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue