Skip to content

Commit

Permalink
Exception Login failure
Browse files Browse the repository at this point in the history
Node :

rx  <failure>
rx    <not-authorized></not-authorized>
rx  </failure>
  • Loading branch information
manufuentescr committed Mar 31, 2014
1 parent 349d6cd commit 8bb67f6
Showing 1 changed file with 21 additions and 5 deletions.
26 changes: 21 additions & 5 deletions src/php/whatsprot.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -1575,10 +1575,18 @@ protected function doLogin()
$this->pollMessages();
}
} while ($this->challengeData == null && ($cnt++ < 100) && (strcmp($this->loginStatus, static::DISCONNECTED_STATUS) == 0));
$this->eventManager()->fireLogin(
$this->phoneNumber
);
$this->sendAvailableForChat();

if(strcmp($this->loginStatus, static::DISCONNECTED_STATUS) == 0)
{
throw new Exception('Login Failure');
}
else
{
$this->eventManager()->fireLogin(
$this->phoneNumber
);
$this->sendAvailableForChat();
}
}

/**
Expand Down Expand Up @@ -1806,9 +1814,17 @@ protected function processInboundData($data, $autoReceipt = true)
protected function processInboundDataNode(ProtocolNode $node, $autoReceipt = true) {
$this->debugPrint($node->nodeString("rx ") . "\n");
$this->serverReceivedId = $node->getAttribute('id');

if ($node->getTag() == "challenge") {
$this->processChallenge($node);
} elseif ($node->getTag() == "success") {
}
elseif($node->getTag() == "failure" )
{

$this->loginStatus = static::DISCONNECTED_STATUS;

}
elseif ($node->getTag() == "success") {
$this->loginStatus = static::CONNECTED_STATUS;
$challengeData = $node->getData();
file_put_contents("nextChallenge.dat", $challengeData);
Expand Down

1 comment on commit 8bb67f6

@manufuentescr
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this does not solve the problem of error login, login is currently not working properly, sometimes the login is correct and sometimes failure

Please sign in to comment.