File tree Expand file tree Collapse file tree 1 file changed +54
-0
lines changed
Expand file tree Collapse file tree 1 file changed +54
-0
lines changed Original file line number Diff line number Diff line change 1+ <?php
2+
3+ /**
4+ * Vesta Control Panel Password Driver
5+ *
6+ * @version 1.0
7+ * @author Serghey Rodin <skid@vestacp.com>
8+ */
9+
10+ class rcube_vesta_password
11+ {
12+ function save ($ curpass , $ passwd )
13+ {
14+ $ rcmail = rcmail::get_instance ();
15+ $ vesta_host = $ rcmail ->config ->get ('password_vesta_host ' );
16+
17+ if (empty ($ vesta_host ))
18+ {
19+ $ vesta_host = 'localhost ' ;
20+ }
21+
22+ $ vesta_port = $ rcmail ->config ->get ('password_vesta_port ' );
23+ if (empty ($ vesta_port ))
24+ {
25+ $ vesta_port = '8083 ' ;
26+ }
27+
28+ $ request = 'email= ' .$ _SESSION ['username ' ].'& ' ;
29+ $ request .= 'password= ' .$ curpass .'& ' ;
30+ $ request .= 'new= ' .$ passwd .'& ' ;
31+
32+
33+ $ context = stream_context_create (array (
34+ 'http ' => array (
35+ 'method ' => 'POST ' ,
36+ 'header ' => 'Content-Type: application/x-www-form-urlencoded ' . PHP_EOL ,
37+ 'content ' => $ request ,
38+ ),
39+ ));
40+
41+ $ result = file_get_contents (
42+ $ file = "https:// " .$ vesta_host .": " .$ vesta_port ."/reset/mail/? " ,
43+ $ use_include_path = false ,
44+ $ context );
45+
46+ if ($ result == 'ok ' ){
47+ return PASSWORD_SUCCESS ;
48+ }
49+ else {
50+ return PASSWORD_ERROR ;
51+ }
52+
53+ }
54+ }
You can’t perform that action at this time.
0 commit comments