filter deactivated users who want to use the API; fix error-output in Customers::update()
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
This commit is contained in:
@@ -86,6 +86,12 @@ abstract class ApiCommand
|
|||||||
}
|
}
|
||||||
$this->logger = FroxlorLogger::getInstanceOf($this->user_data);
|
$this->logger = FroxlorLogger::getInstanceOf($this->user_data);
|
||||||
|
|
||||||
|
// check whether the user is deactivated
|
||||||
|
if ($this->getUserDetail('deactivated') == 1) {
|
||||||
|
$this->logger()->logAction(LOG_ERROR, LOG_INFO, "[API] User '" . $this->getUserDetail('loginnname') . "' tried to use API but is deactivated");
|
||||||
|
throw new Exception("Account suspended", 406);
|
||||||
|
}
|
||||||
|
|
||||||
$this->initLang();
|
$this->initLang();
|
||||||
$this->initMail();
|
$this->initMail();
|
||||||
|
|
||||||
|
|||||||
@@ -199,7 +199,7 @@ class Customers extends ApiCommand implements ResourceEntity
|
|||||||
standard_error(array(
|
standard_error(array(
|
||||||
'stringisempty',
|
'stringisempty',
|
||||||
'myname'
|
'myname'
|
||||||
));
|
), '', true);
|
||||||
} elseif ($firstname == '' && $company == '') {
|
} elseif ($firstname == '' && $company == '') {
|
||||||
standard_error(array(
|
standard_error(array(
|
||||||
'stringisempty',
|
'stringisempty',
|
||||||
@@ -756,23 +756,23 @@ class Customers extends ApiCommand implements ResourceEntity
|
|||||||
standard_error(array(
|
standard_error(array(
|
||||||
'stringisempty',
|
'stringisempty',
|
||||||
'myname'
|
'myname'
|
||||||
));
|
), '', true);
|
||||||
} elseif ($firstname == '' && $company == '') {
|
} elseif ($firstname == '' && $company == '') {
|
||||||
standard_error(array(
|
standard_error(array(
|
||||||
'stringisempty',
|
'stringisempty',
|
||||||
'myfirstname'
|
'myfirstname'
|
||||||
));
|
), '', true);
|
||||||
} elseif ($email == '') {
|
} elseif ($email == '') {
|
||||||
standard_error(array(
|
standard_error(array(
|
||||||
'stringisempty',
|
'stringisempty',
|
||||||
'emailadd'
|
'emailadd'
|
||||||
));
|
), '', true);
|
||||||
} elseif (! validateEmail($email)) {
|
} elseif (! validateEmail($email)) {
|
||||||
standard_error('emailiswrong', $email);
|
standard_error('emailiswrong', $email, true);
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
if ($password != '') {
|
if ($password != '') {
|
||||||
$password = validatePassword($password);
|
$password = validatePassword($password, true);
|
||||||
$password = makeCryptPassword($password);
|
$password = makeCryptPassword($password);
|
||||||
} else {
|
} else {
|
||||||
$password = $result['password'];
|
$password = $result['password'];
|
||||||
|
|||||||
Reference in New Issue
Block a user