Skip to content

Commit

Permalink
Add session logout support
Browse files Browse the repository at this point in the history
  • Loading branch information
dforsber committed Aug 1, 2017
1 parent 7d741bc commit 7a6a06f
Showing 1 changed file with 17 additions and 5 deletions.
22 changes: 17 additions & 5 deletions wscli-php-sdk/src/WsCli.php
Original file line number Diff line number Diff line change
Expand Up @@ -193,14 +193,26 @@ private function handleAccount($api, $cmd, $fromApi, $fromCmd)

private function handleSession($api, $cmd)
{
$error = $this->checkArgs(['email', 'mode']);
if (!$this->getChallenge()) {
$this->log->error("Could not get challenge.");
$error = 1;
}
switch ($cmd) {
case "logout":
$error = $this->checkArgs(['email', 'mode', 'idtoken']);
if ($error) {
return $error;
}
$resp = $this->${"api"}->${"cmd"}(
$this->opts['idtoken'],
$this->opts['email'],
$this->opts['mode']
);
$this->log->debug(print_r($resp, true));
return $resp;
case "loginMFA":
case "login":
$error = $this->checkArgs(['email', 'mode']);
if (!$this->getChallenge()) {
$this->log->error("Could not get challenge.");
$error = 1;
}
if ($error) {
return $error;
}
Expand Down

0 comments on commit 7a6a06f

Please sign in to comment.