mirror of
https://github.com/myvesta/vesta
synced 2025-08-21 05:44:08 -07:00
switched roundcube driver to sockets
This commit is contained in:
parent
ed4ae4530e
commit
22274b2b11
1 changed files with 23 additions and 17 deletions
|
@ -25,25 +25,31 @@ class rcube_vesta_password
|
||||||
$vesta_port = '8083';
|
$vesta_port = '8083';
|
||||||
}
|
}
|
||||||
|
|
||||||
$request = 'email='.$_SESSION['username'].'&';
|
$postvars = array(
|
||||||
$request .= 'password='.$curpass.'&';
|
'email' => $_SESSION['username'],
|
||||||
$request .= 'new='.$passwd.'&';
|
'password' => $curpass,
|
||||||
|
'new' => $passwd
|
||||||
|
);
|
||||||
|
|
||||||
|
$postdata = http_build_query($postvars);
|
||||||
|
|
||||||
|
$send = 'POST /reset/mail/ HTTP/1.1' . PHP_EOL;
|
||||||
|
$send .= 'Host: ' . $vesta_host . PHP_EOL;
|
||||||
|
$send .= 'User-Agent: PHP Script' . PHP_EOL;
|
||||||
|
$send .= 'Content-length: ' . strlen($postdata) . PHP_EOL;
|
||||||
|
$send .= 'Content-type: application/x-www-form-urlencoded' . PHP_EOL;
|
||||||
|
$send .= 'Connection: close' . PHP_EOL;
|
||||||
|
$send .= PHP_EOL;
|
||||||
|
$send .= $postdata . PHP_EOL . PHP_EOL;
|
||||||
|
|
||||||
|
$fp = fsockopen('ssl://' . $vesta_host, $vesta_port);
|
||||||
|
fputs($fp, $send);
|
||||||
|
$result = fread($fp, 2048);
|
||||||
|
fclose($fp);
|
||||||
|
|
||||||
|
|
||||||
$context = stream_context_create(array(
|
if(strpos($result, 'ok') && !strpos($html, 'error'))
|
||||||
'http' => array(
|
{
|
||||||
'method' => 'POST',
|
|
||||||
'header' => 'Content-Type: application/x-www-form-urlencoded' . PHP_EOL,
|
|
||||||
'content' => $request,
|
|
||||||
),
|
|
||||||
));
|
|
||||||
|
|
||||||
$result = file_get_contents(
|
|
||||||
$file = "https://".$vesta_host.":".$vesta_port."/reset/mail/?",
|
|
||||||
$use_include_path = false,
|
|
||||||
$context);
|
|
||||||
|
|
||||||
if ($result == 'ok'){
|
|
||||||
return PASSWORD_SUCCESS;
|
return PASSWORD_SUCCESS;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue