rails g my_app
cd my_app
Gemfile:
gem 'devise'
gem 'devise_ldap_authenticatable'
bundle install
rails g devise:install
rails g devise:views
rails g devise user
rake db:migrate
rails g devise_ldap_authenticatable:install
config/initializers/devise.rb
# config.ldap_create_user = false config.ldap_create_user = true # config.authentication_keys = [ :email ] config.authentication_keys = [ :uid ]
config/ldap.yml anpassen app/controllers/application_controller.rb
class ApplicationController < ActionController::Base rescue_from DeviseLdapAuthenticatable::LdapException do |exception| render :text => exception, :status => 500 end protect_from_forgery before_filter :authenticate_user! end
app/views/devise/sessions/new.html.erb
s/:email/:uid/
s/email_field/text_field/
rails g migration add_uid_to_user uid:string rake db:migrate
rails g first_model first_field:string rake db:migrate