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);
|
||||
|
||||
// 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->initMail();
|
||||
|
||||
|
||||
@@ -199,7 +199,7 @@ class Customers extends ApiCommand implements ResourceEntity
|
||||
standard_error(array(
|
||||
'stringisempty',
|
||||
'myname'
|
||||
));
|
||||
), '', true);
|
||||
} elseif ($firstname == '' && $company == '') {
|
||||
standard_error(array(
|
||||
'stringisempty',
|
||||
@@ -756,23 +756,23 @@ class Customers extends ApiCommand implements ResourceEntity
|
||||
standard_error(array(
|
||||
'stringisempty',
|
||||
'myname'
|
||||
));
|
||||
), '', true);
|
||||
} elseif ($firstname == '' && $company == '') {
|
||||
standard_error(array(
|
||||
'stringisempty',
|
||||
'myfirstname'
|
||||
));
|
||||
), '', true);
|
||||
} elseif ($email == '') {
|
||||
standard_error(array(
|
||||
'stringisempty',
|
||||
'emailadd'
|
||||
));
|
||||
), '', true);
|
||||
} elseif (! validateEmail($email)) {
|
||||
standard_error('emailiswrong', $email);
|
||||
standard_error('emailiswrong', $email, true);
|
||||
} else {
|
||||
|
||||
if ($password != '') {
|
||||
$password = validatePassword($password);
|
||||
$password = validatePassword($password, true);
|
||||
$password = makeCryptPassword($password);
|
||||
} else {
|
||||
$password = $result['password'];
|
||||
|
||||
Reference in New Issue
Block a user