fix for checking @rulingcom.com

This commit is contained in:
Matthew K. Fu JuYuan 2012-07-03 18:21:48 +08:00
parent 9607b5bbfd
commit f7107936d0
1 changed files with 2 additions and 2 deletions

View File

@ -12,7 +12,7 @@ class SessionsController < Devise::SessionsController
login_uid = params[:user][:nccu_ldap_uid] login_uid = params[:user][:nccu_ldap_uid]
result = false result = false
ldap_filter = "(uid=#{login_uid})" ldap_filter = "(uid=#{login_uid})"
if User.first({conditions:{ email: login_uid}}).nil? if /@rulingcom.com$/.match(login_uid).nil?
if ($nccu_ldap_connection.bind rescue false) if ($nccu_ldap_connection.bind rescue false)
logger.info "=LDAP Binded password ok..." logger.info "=LDAP Binded password ok..."
@ -47,7 +47,7 @@ class SessionsController < Devise::SessionsController
else #if rulingcom account else #if rulingcom account
logger.info "=======Rulingcom account======" logger.info "=======Rulingcom account======"
resource = User.first(conditions:{email: login_uid}) resource = User.first(conditions:{email: login_uid})
if resource.valid_password?(params[:user][:password]) if resource.valid_password?(login_password)
resource_name = resource._type.downcase resource_name = resource._type.downcase
sign_in(resource_name, resource) sign_in(resource_name, resource)
respond_with resource, :location => redirect_location(resource_name, resource) respond_with resource, :location => redirect_location(resource_name, resource)