Commit 46e13b7d authored by o's avatar o
Browse files

remove dead code

parent 00f72d23
......@@ -3,8 +3,6 @@ require 'zxcvbn'
class ApplicationController < ActionController::Base
protect_from_forgery with: :exception
before_action :authorize
before_action :set_locale
def handle_unverified_request
......@@ -47,30 +45,6 @@ class ApplicationController < ActionController::Base
session[:locale] = I18n.locale
end
def current_user
@current_user ||= session[:user_id] if session[:user_id]
end
helper_method :current_user
def mail_crypt_enabled?
session[:mail_crypt_enabled]
end
helper_method :mail_crypt_enabled?
def recovery_email_set?
session[:recovery_email_set]
end
helper_method :recovery_email_set?
def resource_enabled?(resource)
session[:possible_resources][resource].present?
end
helper_method :resource_enabled?
def any_resources_enabled?
['jabber'].any?{|r| resource_enabled?(r) }
end
helper_method :any_resources_enabled?
def admin?
@is_admin ||= Admin::Enabled && Admin::Admins.include?(current_user)
end
......@@ -81,22 +55,6 @@ class ApplicationController < ActionController::Base
end
helper_method :feature_toggle?
def authorize
if !current_user
set_locale
page = request.env['PATH_INFO']
if page != '/'
redirect_to "/login?p=#{page}"
else
redirect_to "/login"
end
elsif session_expired?
redirect_to '/logout'
else
update_session_expiry
end
end
def session_expired?
expire_time = session[:expires_at].to_i || Time.now.to_i
expire_time - Time.now.to_i <= 0
......
......@@ -172,9 +172,6 @@ class LoginController < ApplicationController
proof[0...f] == "1"*f
end
def authorize
end
def load_news_frame
@news_frame ||=
Rails.cache.fetch("immerda_news_frame", expires_in: 5.minutes) do
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment