diff --git a/app/controllers/store_confirmation_controller.rb b/app/controllers/store_confirmation_controller.rb new file mode 100644 index 0000000..6a7626c --- /dev/null +++ b/app/controllers/store_confirmation_controller.rb @@ -0,0 +1,13 @@ +class StoreConfirmationController < ApplicationController + + def confirm + if params[:site_token] + site = Site.first + site.confirm_store(params[:site_token]) + render :json => {"success" => "true"} + else + render :json => {"success" => "false"} + end + end + +end \ No newline at end of file diff --git a/app/models/site.rb b/app/models/site.rb index 4942b8d..8593fda 100644 --- a/app/models/site.rb +++ b/app/models/site.rb @@ -56,6 +56,13 @@ class Site index({ access_token: 1}, { unique: true }) + def confirm_store(site_token) + if self.site_token.eql?(site_token) + self.store_confirmation = true + self.save + end + end + def minimum_enabled_locales size = self.in_use_locales.length if size < 1 diff --git a/config/routes.rb b/config/routes.rb index 0199b13..6c08177 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -359,6 +359,8 @@ Orbit::Application.routes.draw do match "/facebook/profile_import" => "facebook#profile_import" match "/desktop/wallpaper_upload" => "desktop#wallpaper_upload" + match "/store_confirmation/confirm" => "store_confirmation#confirm" + #match '/desktop_orbit/eventajaxload' => 'desktop_publications#create_journal' #match '/desktop_orbit/eventajaxload' => 'desktop_publications#delete_journal' # match '/desktop_orbit/eventajaxload' => 'desktop_publications#update_journal'