Merge pull request #3473 from opensaucesystems/master
Small update to user_webdavauth
This commit is contained in:
commit
126a0cac8d
|
@ -1,7 +1,7 @@
|
||||||
<form id="webdavauth" action="#" method="post">
|
<form id="webdavauth" action="#" method="post">
|
||||||
<fieldset class="personalblock">
|
<fieldset class="personalblock">
|
||||||
<legend><strong><?php p($l->t('WebDAV Authentication'));?></strong></legend>
|
<legend><strong><?php p($l->t('WebDAV Authentication'));?></strong></legend>
|
||||||
<p><label for="webdav_url"><?php p($l->t('URL: http://'));?><input type="text" id="webdav_url" name="webdav_url" value="<?php p($_['webdav_url']); ?>"></label>
|
<p><label for="webdav_url"><?php p($l->t('URL: '));?><input type="url" placeholder="https://example.com/webdav" id="webdav_url" name="webdav_url" value="<?php p($_['webdav_url']); ?>"></label>
|
||||||
<input type="hidden" name="requesttoken" value="<?php p($_['requesttoken']) ?>" id="requesttoken">
|
<input type="hidden" name="requesttoken" value="<?php p($_['requesttoken']) ?>" id="requesttoken">
|
||||||
<input type="submit" value="Save" />
|
<input type="submit" value="Save" />
|
||||||
<br /><?php p($l->t('ownCloud will send the user credentials to this URL. This plugin checks the response and will interpret the HTTP statuscodes 401 and 403 as invalid credentials, and all other responses as valid credentials.')); ?>
|
<br /><?php p($l->t('ownCloud will send the user credentials to this URL. This plugin checks the response and will interpret the HTTP statuscodes 401 and 403 as invalid credentials, and all other responses as valid credentials.')); ?>
|
||||||
|
|
|
@ -41,10 +41,16 @@ class OC_USER_WEBDAVAUTH extends OC_User_Backend {
|
||||||
}
|
}
|
||||||
|
|
||||||
public function checkPassword( $uid, $password ) {
|
public function checkPassword( $uid, $password ) {
|
||||||
$url= 'http://'.urlencode($uid).':'.urlencode($password).'@'.$this->webdavauth_url;
|
$arr = explode('://', $this->webdavauth_url, 2);
|
||||||
|
if( ! isset($arr) OR count($arr) !== 2) {
|
||||||
|
OC_Log::write('OC_USER_WEBDAVAUTH', 'Invalid Url: "'.$this->webdavauth_url.'" ', 3);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
list($webdavauth_protocol, $webdavauth_url_path) = $arr;
|
||||||
|
$url= $webdavauth_protocol.'://'.urlencode($uid).':'.urlencode($password).'@'.$webdavauth_url_path;
|
||||||
$headers = get_headers($url);
|
$headers = get_headers($url);
|
||||||
if($headers==false) {
|
if($headers==false) {
|
||||||
OC_Log::write('OC_USER_WEBDAVAUTH', 'Not possible to connect to WebDAV Url: "'.$this->webdavauth_url.'" ', 3);
|
OC_Log::write('OC_USER_WEBDAVAUTH', 'Not possible to connect to WebDAV Url: "'.$webdavauth_protocol.'://'.$webdavauth_url_path.'" ', 3);
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue