Skip to content
Browse files

Removing array return messages from ldap module

Didn't turn out as I had hoped, not my best idea
  • Loading branch information...
1 parent 2b2c3f9 commit e907b95e60b0d7bf10a6086db91b6427ef140728 @justinramel committed Feb 12, 2011
Showing with 5 additions and 15 deletions.
  1. +2 −7 app/models/ldap.rb
  2. +3 −8 app/models/ldap.rb-e
View
9 app/models/ldap.rb
@@ -4,24 +4,19 @@ module Ldap
extend self
LDAP_SUCCESS = 0
- AUTH_FAILED = [:error, "Invalid user id or password"]
GROUP_NOT_FOUND = [:error, "Group not found", []]
ActionFailed = Class.new(StandardError)
SearchFailed = Class.new(StandardError)
UserNotFound = Class.new(StandardError)
def authenticate(user_id, password)
- return AUTH_FAILED if user_id.blank? and password.blank?
+ return false if user_id.blank? and password.blank?
ldap = create_ldap
full_user_id = "#{user_id}@campus.ncl.ac.uk"
ldap.authenticate(full_user_id, password)
- if ldap.bind
- [:notice, "Login successful"]
- else
- AUTH_FAILED
- end
+ ldap.bind
end
def members(group_name)
View
11 app/models/ldap.rb-e
@@ -4,24 +4,19 @@ module Ldap
extend self
LDAP_SUCCESS = 0
- AUTH_FAILED = [:error, "Invalid user id or password"]
GROUP_NOT_FOUND = [:error, "Group not found", []]
ActionFailed = Class.new(StandardError)
SearchFailed = Class.new(StandardError)
UserNotFound = Class.new(StandardError)
def authenticate(user_id, password)
- return AUTH_FAILED if user_id.blank? and password.blank?
+ return false if user_id.blank? and password.blank?
ldap = create_ldap
full_user_id = "#{user_id}@campus.ncl.ac.uk"
ldap.authenticate(full_user_id, password)
- if ldap.bind
- [:notice, "Login successful"]
- else
- AUTH_FAILED
- end
+ ldap.bind
end
def members(group_name)
@@ -154,4 +149,4 @@ module Ldap
validate_result(ldap)
end
end
-end
+end

0 comments on commit e907b95

Please sign in to comment.
Something went wrong with that request. Please try again.