Re: [Refinery CMS:7792] Devise + OmniAuth + Refinery CMS

281 views
Skip to first unread message

Philip Arndt

unread,
Sep 27, 2012, 1:03:58 AM9/27/12
to refine...@googlegroups.com
On your application controller try defining the following method:

def just_installed?
false
end

That might help with this case. Note that you will have to register a user for the backend.

Amit Patel

unread,
Sep 28, 2012, 1:26:52 AM9/28/12
to refine...@googlegroups.com
I tried with your solution but didn't help.

Amit Patel

unread,
Sep 28, 2012, 6:28:37 AM9/28/12
to refine...@googlegroups.com
I rearrange route configuration like below

root :to => "home#index"
mount Refinery::Core::Engine, :at => '/'
So now I can see existing apps home page but when I call /refineray it asks me for login even if I already logged in with twitter.

Any idea?

On Thursday, September 27, 2012 9:48:36 AM UTC+5:30, Amit Patel wrote:

We have used Devise + OmniAuth as authentication mechanism to authenticate user with facebook, twitter and openid in our existing aplication. Now we need to integrate Refinery CMS into the application.

Requirement: The home page of application has Signup/Signin buttons with some static content. On Signing in, user is able to access restricted area. We want to add a link to access Refinery CMS on a restricted page. It should not ask for any credential again.

We followed following links to integrate Refinery CMS:

  1. http://refinerycms.com/guides/with-an-existing-rails-app
  2. http://refinerycms.com/guides/with-an-existing-rails-31-devise-app

Now after starting server, when we hit http://localhost:3000 it redirects tohttp://localhost:3000/refinery/users/register. Instead user should be able to see home page with public content. User can access refinery CMS(through /help link) only after user authenticate himself with any of authentication providers.

Here is snap of config/routes.rb

mount Refinery::Core::Engine, :at => '/'
...
devise_for
:users, :controllers => { :omniauth_callbacks => "users/omniauth_callbacks", registrations: "registrations" }
....
root
:to => "home#index"

config/application.rb

config.autoload_paths += Dir["#{config.root}/lib/**/"] # to load files from lib directory, including subfolders

    config
.before_initialize do
     
require 'refinery_patch'
     
require 'restrict_refinery_to_refinery_users'
   
end

    include
Refinery::Engine
    after_inclusion
do
     
[ApplicationController, ApplicationHelper].each do |c|
        c
.send :include, ::RefineryPatch
     
end

     
::Refinery::AdminController.send :include, ::RestrictRefineryToRefineryUsers
     
::Refinery::AdminController.send :before_filter, :restrict_refinery_to_refinery_users
   
end

We are beginner. Any help would be appreciable.






Reply all
Reply to author
Forward
0 new messages