[FIX] Wrong behavior on Edit Account with no addy

When an account is edited and no payment address has been set, the following non-sense message appears:
Unable to connect to RPC server for coin address validation

This patch fixes the issue and allows profile to be edited with no payment address
This commit is contained in:
poolpm 2013-12-27 16:21:25 +01:00
parent 91e7413539
commit c9215475b0

View File

@ -281,20 +281,22 @@ class User extends Base {
$this->setErrorMessage('Invalid email address'); $this->setErrorMessage('Invalid email address');
return false; return false;
} }
if ($this->bitcoin->can_connect() === true && !empty($address)) { if (!empty($address)) {
try { if ($this->bitcoin->can_connect() === true) {
$aStatus = $this->bitcoin->validateaddress($address); try {
if (!$aStatus['isvalid']) { $aStatus = $this->bitcoin->validateaddress($address);
$this->setErrorMessage('Invalid coin address'); if (!$aStatus['isvalid']) {
$this->setErrorMessage('Invalid coin address');
return false;
}
} catch (BitcoinClientException $e) {
$this->setErrorMessage('Unable to verify coin address');
return false; return false;
} }
} catch (BitcoinClientException $e) { } else {
$this->setErrorMessage('Unable to verify coin address'); $this->setErrorMessage('Unable to connect to RPC server for coin address validation');
return false; return false;
} }
} else {
$this->setErrorMessage('Unable to connect to RPC server for coin address validation');
return false;
} }
// Number sanitizer, just in case we fall through above // Number sanitizer, just in case we fall through above