Exemplo n.º 1
0
 /**
  * @brief Check if the password is correct
  * @param $uid The username
  * @param $password The password
  * @returns true/false
  *
  * Check if the password is correct without logging in the user
  */
 public function checkPassword($uid, $password)
 {
     //find out dn of the user name
     $filter = str_replace('%uid', $uid, OC_LDAP::conf('ldapLoginFilter'));
     $ldap_users = OC_LDAP::fetchListOfUsers($filter, 'dn');
     if (count($ldap_users) < 1) {
         return false;
     }
     $dn = $ldap_users[0];
     //are the credentials OK?
     if (!OC_LDAP::areCredentialsValid($dn, $password)) {
         return false;
     }
     //update some settings, if necessary
     $this->updateQuota($dn);
     $this->updateEmail($dn);
     //give back the display name
     return OC_LDAP::dn2username($dn);
 }