internetee-registry/app/controllers/registrar_controller.rb
2015-06-29 12:31:47 +03:00

29 lines
708 B
Ruby

class RegistrarController < ApplicationController
before_action :authenticate_user!, :check_ip
layout 'registrar/application'
include Registrar::ApplicationHelper
helper_method :depp_controller?
def depp_controller?
false
end
def check_ip
return unless current_user
unless current_user.is_a? ApiUser
sign_out(current_user)
return
end
return if Rails.env.development?
return if current_user.registrar.registrar_ip_white?(request.ip)
flash[:alert] = t('access_denied')
sign_out(current_user)
redirect_to registrar_login_path and return
end
helper_method :head_title_sufix
def head_title_sufix
t(:registrar_head_title_sufix)
end
end