apps/user_external/lib/webdavauth.php
/**
	 * Check if the password is correct without logging in the user
	 *
	 * @param string $uid      The username
	 * @param string $password The password
	 *
	 * @return true/false
	 */
Check if the password is correct without logging in the user
@param string $uid      The username
@param string $password The password

@return true/false
Check if the password is correct without logging in the user @param string $uid The username @param string $password The password @return true / false
public function checkPassword($uid, $password) {
		$arr = explode('://', $this->webDavAuthUrl, 2);
		if( ! isset($arr) OR count($arr) !== 2) {
			\OCP\Util::writeLog('OC_USER_WEBDAVAUTH', 'Invalid Url: "'.$this->webDavAuthUrl.'" ', 3);
			return false;
		}
		list($protocol, $path) = $arr;
		$url= $protocol.'://'.urlencode($uid).':'.urlencode($password).'@'.$path;
		$headers = get_headers($url);
		if($headers==false) {
			\OCP\Util::writeLog('OC_USER_WEBDAVAUTH', 'Not possible to connect to WebDAV Url: "'.$protocol.'://'.$path.'" ', 3);
			return false;
		}
		$returnCode= substr($headers[0], 9, 3);
		if(substr($returnCode, 0, 1) === '2') {
			$this->storeUser($uid);
			return $uid;
		} else {
			return false;
		}
	}
public function checkPassword ( $ uid , $ password ) { $ arr = explode ( '://' , $ this -> webDavAuthUrl , 2 ) ; if ( ! isset ( $ arr ) OR count ( $ arr ) !== 2 ) { \ OCP \ Util :: writeLog ( 'OC_USER_WEBDAVAUTH' , 'Invalid Url: "' . $ this -> webDavAuthUrl . '" ' , 3 ) ; return false ; } list ( $ protocol , $ path ) = $ arr ; $ url = $ protocol . '://' . urlencode ( $ uid ) . ':' . urlencode ( $ password ) . '@' . $ path ; $ headers = get_headers ( $ url ) ; if ( $ headers == false ) { \ OCP \ Util :: writeLog ( 'OC_USER_WEBDAVAUTH' , 'Not possible to connect to WebDAV Url: "' . $ protocol . '://' . $ path . '" ' , 3 ) ; return false ; } $ returnCode = substr ( $ headers [ 0 ] , 9 , 3 ) ; if ( substr ( $ returnCode , 0 , 1 ) === '2' ) { $ this -> storeUser ( $ uid ) ; return $ uid ; } else { return false ; } }
Check if the password is correct without logging in the user
 @param string $uid      The username
 @param string $password The password
Check if the password is correct without logging in the user @param string $uid The username @param string $password The password