lib/puavo/authentication.rb in puavo_authentication-0.0.6 vs lib/puavo/authentication.rb in puavo_authentication-0.0.7
- old
+ new
@@ -13,9 +13,10 @@
user = User.find(:first, :attribute => "uid", :value => login)
if user.bind(password)
host = LdapBase.configuration[:host]
base = LdapBase.base.to_s
+ user.remove_connection
LdapBase.ldap_setup_connection(host, base, user.dn, password)
# Allow authetication only if user is School Admin in the some School or organisation owner.
if School.find( :first, :attribute => "puavoSchoolAdmin", :value => user.dn ) ||
LdapOrganisation.first.owner.include?(user.dn)