some mod for user registeration

This commit is contained in:
Harry Bomrah 2017-04-12 18:29:23 +08:00
parent ce3230f21a
commit 4fa49d0b1b
2 changed files with 9 additions and 1 deletions

View File

@ -15,6 +15,14 @@ class Admin::RegisterApiController < ApplicationController
site.title_translations = title site.title_translations = title
site.generate_confirmation_token site.generate_confirmation_token
site.save 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 response["success"] = true
else else
response["message"] = "Site already registered." response["message"] = "Site already registered."