diff --git a/lib/classes/api/abstract.ApiCommand.php b/lib/classes/api/abstract.ApiCommand.php index 1dafc054..f499140b 100644 --- a/lib/classes/api/abstract.ApiCommand.php +++ b/lib/classes/api/abstract.ApiCommand.php @@ -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(); diff --git a/lib/classes/api/commands/class.Customers.php b/lib/classes/api/commands/class.Customers.php index bc2fb55b..bfad0ba9 100644 --- a/lib/classes/api/commands/class.Customers.php +++ b/lib/classes/api/commands/class.Customers.php @@ -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'];