From cd2666dd74e157fbc3f26312189574abfe716d03 Mon Sep 17 00:00:00 2001 From: Harry Bomrah Date: Fri, 15 Apr 2016 18:18:58 +0800 Subject: [PATCH] change url mechanism --- app/controllers/admin/register_api_controller.rb | 11 +++++++++++ config/routes.rb | 1 + 2 files changed, 12 insertions(+) diff --git a/app/controllers/admin/register_api_controller.rb b/app/controllers/admin/register_api_controller.rb index 2163b1d..c95765d 100644 --- a/app/controllers/admin/register_api_controller.rb +++ b/app/controllers/admin/register_api_controller.rb @@ -45,6 +45,17 @@ class Admin::RegisterApiController < ApplicationController end end + def re_register_url + site_token = params[:store_token] + site = RegisteredSite.find_by(:uid => site_token) rescue nil + if !site.nil? + site.site_domain = params[:site_domain] + render :json => {"success" => true}.to_json + else + render :json => {"success" => false}.to_json + end + end + def check_permissions response = {} response["success"] = false diff --git a/config/routes.rb b/config/routes.rb index 543c003..d0cd881 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -3,6 +3,7 @@ Rails.application.routes.draw do locales = Site.first.in_use_locales rescue I18n.available_locales scope "(:locale)", locale: Regexp.new(locales.join("|")) do + post "/xhr/site/re_register_url", to: 'admin/register_api#re_register_url' namespace :admin do get "/registered_site/change_access/:uid" => "registered_sites#change_access_status" resources :registered_sites