docs/devise.md in headmin-0.1.2 vs docs/devise.md in headmin-0.2.0

- old
+ new

@@ -1,62 +1,3 @@ # Authentication -We use the gem Devise for authentication. In this example, two different user types will be set up: -Admin and normal User. Only admins have access to the headmin back office. It is optional if normal users -are allowed to login/register from the website. - -##Installation - -#### Setup devise -Add the gem devise and bundle install. Create a user model: - -``` -rails generate devise User -``` - -Add the field "type" to the user model -``` -rails g migration AddTypeToUsers type:string -rails db:migrate -``` - -In models/ add the file admin.rb -``` -class Admin < User -end -``` - -#### Setup routes -In routes.rb -``` -namespace(:admin) do - devise_for :admins, path: 'users', singular: 'admin', controllers: { - sessions: 'admin/users/sessions', - registrations: 'admin/users/registrations', - passwords: 'admin/users/passwords', - unlocks: 'admin/users/unlocks', - confirmations: 'admin/users/confirmations', - } -end -``` - -In case, no normal users are necessary, you can discard the next step: -``` -scope module: 'website' do - devise_for :users, controllers: { - sessions: 'website/users/sessions', - registrations: 'website/users/registrations', - passwords: 'website/users/passwords', - unlocks: 'website/users/unlocks', - confirmations: 'website/users/confirmations', - } -end -``` - -#### Setup protected routes and configuration for headmin -In controllers/admin_controller.rb -``` -class AdminController < ApplicationController - alias_method :devise_current_user, :current_user - include Headmin::Authentication -end -``` +TODO: rewrite \ No newline at end of file