add license
This commit is contained in:
@@ -4,7 +4,7 @@ class ApplicationController < ActionController::Base
|
||||
protect_from_forgery with: :exception
|
||||
|
||||
# lookup domain for db from provision
|
||||
before_action :lookup_domain, :set_locale
|
||||
before_action :check_license, :lookup_domain, :set_locale
|
||||
|
||||
helper_method :current_company,:current_login_employee,:current_user
|
||||
# alias_method :current_user, :current_login_employee,:current_user
|
||||
@@ -94,7 +94,10 @@ class ApplicationController < ActionController::Base
|
||||
|
||||
private
|
||||
def check_license
|
||||
if current_company.nil?
|
||||
# if current_company.nil?
|
||||
# redirect_to install_path
|
||||
# end
|
||||
if !File.directory?("/config/license.yml")
|
||||
redirect_to install_path
|
||||
end
|
||||
end
|
||||
|
||||
@@ -7,18 +7,4 @@ module ApplicationHelper
|
||||
when :alert then "alert alert-error fade-in"
|
||||
end
|
||||
end
|
||||
|
||||
# For Pageless
|
||||
# def pageless(total_pages, url=nil, container=nil)
|
||||
# opts = {
|
||||
# :totalPages => total_pages,
|
||||
# :url => url,
|
||||
# :loaderMsg => 'Loading more pages...',
|
||||
# :loaderImage => image_path('load.gif')
|
||||
# }
|
||||
|
||||
# container && opts[:container] ||= container
|
||||
|
||||
# javascript_tag("$('#{container}').pageless(#{opts.to_json});")
|
||||
# end
|
||||
end
|
||||
|
||||
@@ -13,14 +13,14 @@ class License
|
||||
|
||||
def initialize(server = "", lookup = "")
|
||||
#this code is hard-code to reflect server mode - Very important.
|
||||
self.server_mode = "cloud"
|
||||
self.server_mode = ENV["server_mode"]
|
||||
|
||||
if (server != "")
|
||||
self.class.base_uri server
|
||||
end
|
||||
|
||||
@secret = SecureRandom.hex(10)
|
||||
@params = { query: { device: "SXlite", token: SECRETS_CONFIG['provision_key'] } }
|
||||
@params = { query: { device: "SX", token: SECRETS_CONFIG['provision_key'] } }
|
||||
end
|
||||
|
||||
def shop_code
|
||||
@@ -106,7 +106,7 @@ class License
|
||||
|
||||
def check_remote_license(license_key)
|
||||
# @options = { query: {device: "cloud", key: license_key, skey: @secret, token: Rails.application.secrets.provision_key} }
|
||||
@options = { query: {device: "SXlite", key: license_key, skey: @secret, token: SECRETS_CONFIG['provision_key']} }
|
||||
@options = { query: {device: "SX", key: license_key, skey: @secret, token: SECRETS_CONFIG['provision_key']} }
|
||||
response = self.class.get("/license", @options)
|
||||
|
||||
@license = response.parsed_response
|
||||
@@ -120,7 +120,7 @@ class License
|
||||
end
|
||||
|
||||
def verify_by_api_token(api_token)
|
||||
@options = { query: {device: "SXlite", api_token: api_token, skey: @secret, token: SECRETS_CONFIG['provision_key']} }
|
||||
@options = { query: {device: "SX", api_token: api_token, skey: @secret, token: SECRETS_CONFIG['provision_key']} }
|
||||
response = self.class.get("/verify", @options)
|
||||
|
||||
@license = response.parsed_response
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
development:
|
||||
server_mode: cloud #local
|
||||
server_mode: local
|
||||
sx_provision_url: http://192.168.1.162:3005/api
|
||||
expired_date: 2017-11-09 05:02:33
|
||||
|
||||
|
||||
test:
|
||||
|
||||
Reference in New Issue
Block a user