Files
sx-fc/app/controllers/review_license_controller.rb
2020-06-19 12:02:32 +06:30

35 lines
878 B
Ruby

class ReviewLicenseController < BaseController
before_action :lookup_domain
def index
@license = current_license
@plan = @license.read_license("plan_name")
@bis_name = @license.read_license_no_decrypt("shop_name")
@expired_at = @license.read_license("renewable_date")
@license_status = @license.detail_with_local_file
end
def create
if current_license.verify_license
redirect_to root_path
else
redirect_to review_license_path, flash: { message: '*** License can not be verified ***' }
end
end
private
def lookup_domain
if ENV["SERVER_MODE"] == "cloud"
not_found
elsif ENV["SERVER_MODE"] == "application" || request.subdomains.last && request.subdomains.last != "www"
if !current_license.exists? #(request.host)
redirect_to activate_path
end
else
not_found
end
end
end