Skip to content

Unable to authenticate custom admin pages and controllers using refinerycms-authentication-devise #28

@ITDevMohsin

Description

@ITDevMohsin

Hi,

I have installed refinery cms and need to add custom controller, currently I have added all my controllers and they are working fine as well.

Basically, its admin controller that is other than refinery controllers whom I wants to authenticate if user is not logged in.

so, if no user is logged into the site, it will redirect it to refinery/login page.

I have admin controller whose code is like:

require 'refinery/core/nil_user'

class AdminController < ApplicationController # Refinery::Admin::CoreController
  include RefineryAuthenticationPatch

  include ::Refinery::ApplicationController
  helper Refinery::Core::Engine.helpers

  include Refinery::Admin::BaseController
  include Refinery::Authentication::Devise
end

My gem file:

gem 'refinerycms'
gem 'refinerycms-authentication-devise', '~> 1.0.4'
gem 'refinerycms-wymeditor', '~> 1.0', '>= 1.0.6'

Some page code:

<%= form_for([:admin, @current_object]) do |f| %>
    <div class='field'>
      <%= f.label :title %>
      <%= f.text_field :title, :class => 'larger widest' %>
    </div>
<% end %>

And my link is something like: http://localhost:3000/admin/teachers/new. These links are of in great number so I wants to authenticate all of them. So, if user try to access these pages by putting URL in browser, so it will redirect user to login page.

Simply, what I need to do is if some one directly access http://localhost:3000/admin/teachers/new page, he should redirected to refinery/login page.

For all other controllers or pages the behavior is working fine but I want to fix it for these custom pages now.

I have tried loads of codes and things regarding device or refinery authentications but all in vain.

Here is my reference question on google group as well:

https://groups.google.com/forum/#!topic/refinery-cms/yQ_OWIKxLdY

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions