Search code examples
ruby-on-railsrubyruby-on-rails-3devise

Two different login pages for one model with devise on rails


I am working on an rails app in which there is one table Users, which has two roles Admin and member. Until now I am using single login page.

But now, I need to make two different login pages with completely different styling for admin and member. Moreover Admin don't have sign_up option but member has.

I am totally confused that is it possible or not? If possible, how to achieve this.


Solution

  • Devise sign in form is just a form with action matching to devise controller.

    You can write this form code anywhere you like,

    <%= form_for(:user, :url => session_path(:user)) do |f| %>
      <%= f.text_field :email %>
      <%= f.password_field :password %>
      <%= f.check_box :remember_me %>
      <%= f.label :remember_me %>
      <%= f.submit 'Sign in' %>
      <%= link_to "Forgot your password?", new_password_path(:user) %>
    <% end %>