Merge branch 'master' into 'master'
fix error See merge request harry/registered-sites!3
This commit is contained in:
commit
e4ac28c1da
|
@ -29,7 +29,8 @@ class Admin::RegisterApiController < ApplicationController
|
||||||
response["error"] = "SITE_ALREADY_REGISTERED"
|
response["error"] = "SITE_ALREADY_REGISTERED"
|
||||||
end
|
end
|
||||||
if !site.nil?
|
if !site.nil?
|
||||||
p1 = fork {register_client_site(site.site_token) }
|
send_confirmation_email(site.admin_email, site.confirmation_token, site.site_token)
|
||||||
|
p1 = fork {register_client_site(site,site.site_token) }
|
||||||
Process.detach(p1)
|
Process.detach(p1)
|
||||||
end
|
end
|
||||||
render :json => ((params[:success] == 'error') ? response.merge({'success'=>params[:success]}).to_json : response.to_json)
|
render :json => ((params[:success] == 'error') ? response.merge({'success'=>params[:success]}).to_json : response.to_json)
|
||||||
|
@ -65,8 +66,7 @@ class Admin::RegisterApiController < ApplicationController
|
||||||
watch_list_save_flag = (params['user']!= 'rulingcom' && params['user'].to_s != '')
|
watch_list_save_flag = (params['user']!= 'rulingcom' && params['user'].to_s != '')
|
||||||
user_name = params['user']
|
user_name = params['user']
|
||||||
puts ['user_name',user_name]
|
puts ['user_name',user_name]
|
||||||
site_anncs = SiteAnnc
|
site_anncs = SiteAnnc.where(visible: true)
|
||||||
.where(visible: true)
|
|
||||||
.select{|v| v.send_all || v.recieve_sites.include?(site)}.collect do |v|
|
.select{|v| v.send_all || v.recieve_sites.include?(site)}.collect do |v|
|
||||||
if watch_list_save_flag
|
if watch_list_save_flag
|
||||||
watch_list = v.watch_list
|
watch_list = v.watch_list
|
||||||
|
@ -103,7 +103,10 @@ class Admin::RegisterApiController < ApplicationController
|
||||||
render :json => ((params[:success] == 'error') ? response.merge(params).to_json : response.to_json)
|
render :json => ((params[:success] == 'error') ? response.merge(params).to_json : response.to_json)
|
||||||
end
|
end
|
||||||
|
|
||||||
def register_client_site(store_token)
|
def register_client_site(site=nil,store_token)
|
||||||
|
if !site.nil?
|
||||||
|
send_confirmation_email(site.admin_email, site.confirmation_token, site.site_token)
|
||||||
|
end
|
||||||
params_to_send = {'store_token' => store_token, "site_token" => params[:site_token]}
|
params_to_send = {'store_token' => store_token, "site_token" => params[:site_token]}
|
||||||
uri = URI.parse("http://#{params[:site_domain]}/")
|
uri = URI.parse("http://#{params[:site_domain]}/")
|
||||||
http = Net::HTTP.new(uri.host,uri.port)
|
http = Net::HTTP.new(uri.host,uri.port)
|
||||||
|
|
Loading…
Reference in New Issue