diff --git a/app/controllers/admin/register_api_controller.rb b/app/controllers/admin/register_api_controller.rb index 74fcff6..2071f65 100644 --- a/app/controllers/admin/register_api_controller.rb +++ b/app/controllers/admin/register_api_controller.rb @@ -15,6 +15,14 @@ class Admin::RegisterApiController < ApplicationController site.title_translations = title site.generate_confirmation_token site.save + cp = CPanelUser.where(:email => email).first rescue nil + if cp.nil? + cp = CPanelUser.new(:email => email, :password => SecureRandom.hex(5)) + end + if !cp.first_time_run + cp.registered_site_ids << site.id.to_s + end + cp.save response["success"] = true else response["message"] = "Site already registered." diff --git a/app/views/admin/registered_sites/_index.html.erb b/app/views/admin/registered_sites/_index.html.erb index 4a5d048..719536b 100644 --- a/app/views/admin/registered_sites/_index.html.erb +++ b/app/views/admin/registered_sites/_index.html.erb @@ -23,7 +23,7 @@