From 4fa49d0b1b77a38998502b0eb3cbeaf6e623b7f5 Mon Sep 17 00:00:00 2001 From: Harry Bomrah Date: Wed, 12 Apr 2017 18:29:23 +0800 Subject: [PATCH] some mod for user registeration --- app/controllers/admin/register_api_controller.rb | 8 ++++++++ app/views/admin/registered_sites/_index.html.erb | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) 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 @@ <%= site.admin_email %> - <% if !site.site_confirmed %> + <% if !site.site_confirmed %> <%= t("registered_sites.site_inactive") %>
<%= t("registered_sites.email_not_confirmed") %> <% elsif !site.access_granted %>