Skip to content

Commit a0dcb5e

Browse files
author
x86
committed
Fixed login() when using wrong credentials
1 parent 3ad2a09 commit a0dcb5e

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

pve2_api.class.php

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,16 +106,23 @@ public function login () {
106106
curl_setopt($prox_ch, CURLOPT_POST, true);
107107
curl_setopt($prox_ch, CURLOPT_RETURNTRANSFER, true);
108108
curl_setopt($prox_ch, CURLOPT_POSTFIELDS, $login_postfields_string);
109-
curl_setopt($prox_ch, CURLOPT_SSL_VERIFYPEER, false);
109+
curl_setopt($prox_ch, CURLOPT_SSL_VERIFYPEER, false); // true = verify SSL certificate
110110

111111
$login_ticket = curl_exec($prox_ch);
112112

113113
curl_close($prox_ch);
114114
unset($prox_ch);
115115
unset($login_postfields_string);
116116

117+
if ( !$login_ticket )
118+
{
119+
// Wrong SSL / connection timed out
120+
$this->pve_login_ticket_timestamp = null;
121+
return false;
122+
}
123+
117124
$login_ticket_data = json_decode($login_ticket, true);
118-
if ($login_ticket_data == null) {
125+
if ($login_ticket_data == null || $login_ticket_data['data'] == null) {
119126
# Login failed.
120127
# Just to be safe, set this to null again.
121128
$this->pve_login_ticket_timestamp = null;

0 commit comments

Comments
 (0)