From f7107936d077999100f76678aef7a15e4d34908a Mon Sep 17 00:00:00 2001 From: "Matthew K. Fu JuYuan" Date: Tue, 3 Jul 2012 18:21:48 +0800 Subject: [PATCH] fix for checking @rulingcom.com --- app/controllers/sessions_controller.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controllers/sessions_controller.rb b/app/controllers/sessions_controller.rb index be961ac2..23a89c38 100644 --- a/app/controllers/sessions_controller.rb +++ b/app/controllers/sessions_controller.rb @@ -12,7 +12,7 @@ class SessionsController < Devise::SessionsController login_uid = params[:user][:nccu_ldap_uid] result = false 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) logger.info "=LDAP Binded password ok..." @@ -47,7 +47,7 @@ class SessionsController < Devise::SessionsController else #if rulingcom account logger.info "=======Rulingcom account======" 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 sign_in(resource_name, resource) respond_with resource, :location => redirect_location(resource_name, resource)