Skip to content

Commit

Permalink
fixed datetime formatting at cookie header
Browse files Browse the repository at this point in the history
  • Loading branch information
Tobias Franek authored and Tobias Franek committed Feb 2, 2017
1 parent 63ddb71 commit 663401b
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/Webuntis.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,7 @@ public function __construct(array $config) {
$this->currentUserType = $cache->fetch($config['username'])['userType'];
$this->session = $cache->fetch($config['username'])['session'];
$httpClient = new HttpClient($this->path);
$date = new \DateTime();
$newDate = $date->add(new \DateInterval('PT1209600S'));
$newDate = $cache->fetch($config['tokenCreatedAt'])->add(new \DateInterval('PT1200000S'));
$httpClient->withCookies([
'JSESSIONID' => $this->session,
'Path' => '/WebUntis',
Expand Down Expand Up @@ -118,7 +117,8 @@ public function authenticate($username, $password) {
$cache->save($username, [
'session' => $result['sessionId'],
'userId' => $this->currentUserId,
'userType' => $this->currentUserType
'userType' => $this->currentUserType,
'tokenCreatedAt' => new \DateTime()
]);

$this->session = $result['sessionId'];
Expand Down

0 comments on commit 663401b

Please sign in to comment.