LDAP connection and modified Devise

This commit is contained in:
Matt Fu committed 2012-02-22 14:43:24 +08:00
1 parent 9cd3cbc478
commit 678f1eabef
22 files changed
+245 -17

No files matched your search

+1 -1
View File
@@ -19,7 +19,7 @@ module PrototypeR4
# Add directories for plugins
config.paths["vendor/plugins"] += %W(#{config.root}/vendor/built_in_modules)
config.paths["vendor/plugins"] += %W(#{config.root}/vendor/downloaded_modules)
config.paths.app.views << "app/views/devise"
# Settings in config/environments/* take precedence over those specified here.
# Application configuration should go into files in config/initializers
+15 -15
View File
@@ -24,21 +24,21 @@ PrototypeR4::Application.configure do
config.action_dispatch.best_standards_support = :builtin
config.middleware.use ExceptionNotifier,
:email_prefix => "[R4_error]",
:sender_address => %{"notifier" <redmine@rulingcom.com>},
:exception_recipients => %w{chris@rulingcom.com}
config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = {
:tls => true,
:enable_starttls_auto => true,
:address => "smtp.gmail.com",
:port => '587',
:domain => "smtp.gmail.com",
:authentication => "plain",
:user_name => "redmine@rulingcom.com",
:password => "rulingredmine" }
# config.middleware.use ExceptionNotifier,
# :email_prefix => "[R4_error]",
# :sender_address => %{"notifier" <redmine@rulingcom.com>},
# :exception_recipients => %w{chris@rulingcom.com}
#
# config.action_mailer.delivery_method = :smtp
# config.action_mailer.smtp_settings = {
# :tls => true,
# :enable_starttls_auto => true,
# :address => "smtp.gmail.com",
# :port => '587',
# :domain => "smtp.gmail.com",
# :authentication => "plain",
# :user_name => "redmine@rulingcom.com",
# :password => "rulingredmine" }
end
+5
View File
@@ -21,6 +21,8 @@ Devise.setup do |config|
# parameters are used only when authenticating and not when retrieving from
# session. If you need permissions, you should implement that in a before filter.
# config.authentication_keys = [ :email ]
config.authentication_keys = [ :nccu_ldap_uid ]
# Tell if authentication through request.params is enabled. True by default.
# config.params_authenticatable = true
@@ -139,4 +141,7 @@ Devise.setup do |config|
# end
# manager.default_strategies(:scope => :user).unshift :twitter_oauth
# end
config.warden do |manager|
manager.default_strategies.unshift :check_nccu_ldap
end
end
+19
View File
@@ -0,0 +1,19 @@
# Warden::Strategies.add(:check_nccu_ldap) do
# def valid?
# # code here to check whether to try and authenticate using this strategy;
# params['nccu_ldap_uid'] && params['password']
# end
# def authenticate!
# debugger
# user = User.first(conditions:{ nccu_ldap_uid: "901001" })
# if user
# success! user
# else
# success! User.create
#
# # fail!(message)
# # User.create
# end
# end
#
# end
+2
View File
@@ -9,6 +9,8 @@ en:
failure:
unauthenticated: 'You need to sign in or sign up before continuing.'
unconfirmed: 'You have to confirm your account before continuing.'
ldap_invalid: 'Your LDAP account is invalid'
ldap_connection_failed: 'LDAP connection failed'
locked: 'Your account is locked.'
invalid: 'Invalid email or password.'
invalid_token: 'Invalid authentication token.'
+2
View File
@@ -9,6 +9,8 @@ zh_tw:
failure:
unauthenticated: '您需要先註冊、登入後才能繼續。'
unconfirmed: '您的帳號需需要經過確認後,才能繼續。'
ldap_invalid: '您的LDAP帳號錯誤'
ldap_connection_failed: '與LDAP之間連線異常'
locked: '您的帳號已被鎖定。'
invalid: 'Email 或密碼是無效的。'
invalid_token: '無效的認證代碼。'
+1 -1
View File
@@ -1,6 +1,6 @@
PrototypeR4::Application.routes.draw do
devise_for :users
devise_for :users,:controllers => {:sessions => 'sessions'}
# routes for sinatra app
match '/site/set_registered', :to => CentralServerExchangeApp