mirror of
https://github.com/myvesta/vesta
synced 2025-08-14 02:28:05 -07:00
added roundcube driver for vesta reset api
This commit is contained in:
parent
e84f7e2709
commit
44829483b6
1 changed files with 54 additions and 0 deletions
54
install/0.9.7/rhel/roundcube-driver.php
Normal file
54
install/0.9.7/rhel/roundcube-driver.php
Normal file
|
@ -0,0 +1,54 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Vesta Control Panel Password Driver
|
||||
*
|
||||
* @version 1.0
|
||||
* @author Serghey Rodin <skid@vestacp.com>
|
||||
*/
|
||||
|
||||
class rcube_vesta_password
|
||||
{
|
||||
function save($curpass, $passwd)
|
||||
{
|
||||
$rcmail = rcmail::get_instance();
|
||||
$vesta_host = $rcmail->config->get('password_vesta_host');
|
||||
|
||||
if (empty($vesta_host))
|
||||
{
|
||||
$vesta_host = 'localhost';
|
||||
}
|
||||
|
||||
$vesta_port = $rcmail->config->get('password_vesta_port');
|
||||
if (empty($vesta_port))
|
||||
{
|
||||
$vesta_port = '8083';
|
||||
}
|
||||
|
||||
$request = 'email='.$_SESSION['username'].'&';
|
||||
$request .= 'password='.$curpass.'&';
|
||||
$request .= 'new='.$passwd.'&';
|
||||
|
||||
|
||||
$context = stream_context_create(array(
|
||||
'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;
|
||||
}
|
||||
else {
|
||||
return PASSWORD_ERROR;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue