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.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."

View File

@ -23,7 +23,7 @@
</td>
<td><%= site.admin_email %></td>
<td>
<% if !site.site_confirmed %>
<% if !site.site_confirmed %>
<span class="badge badge-important"><%= t("registered_sites.site_inactive") %></span><br />
<%= t("registered_sites.email_not_confirmed") %>
<% elsif !site.access_granted %>