Skip to content

Commit 33a462d

Browse files
committed
Merge pull request #16 from GamerSource/testing
Added support to set cookie through the API client. Example usecase: …
2 parents 5255fda + 7b1496f commit 33a462d

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

pve2_api.class.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,14 @@ public function login () {
120120
}
121121
}
122122

123+
public function setCookie() {
124+
if (!$this->check_login_ticket()) {
125+
throw new PVE2_Exception("Not logged into Proxmox host. No Login access ticket found or ticket expired.", 3);
126+
}
127+
128+
setcookie("PVEAuthCookie",$this->login_ticket['ticket']);
129+
}
130+
123131
/*
124132
* bool check_login_ticket ()
125133
* Checks if the login ticket is valid still, returns false if not.

0 commit comments

Comments
 (0)