Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/ocsms.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLoic Blot <loic.blot@unix-experience.fr>2017-12-28 18:56:31 +0300
committerLoic Blot <loic.blot@unix-experience.fr>2017-12-28 18:56:31 +0300
commit9a6d6907cff51235b14ca4294059cbd8d45d0989 (patch)
treec8ad23f7999c8fac122c6c4799b16651f2908542 /controller
parent7dd75ea74a095a514c3a5ef57f961ba9e7160bdb (diff)
apicontroller.php: Return error 400 when messages are not accepted on push
Diffstat (limited to 'controller')
-rw-r--r--controller/apicontroller.php14
1 files changed, 10 insertions, 4 deletions
diff --git a/controller/apicontroller.php b/controller/apicontroller.php
index 1749ebb..9170773 100644
--- a/controller/apicontroller.php
+++ b/controller/apicontroller.php
@@ -76,7 +76,10 @@ class ApiController extends Controller {
*/
public function push ($smsCount, $smsDatas) {
if ($this->checkPushStructure($smsCount, $smsDatas) === false) {
- return new JSONResponse(array("status" => false, "msg" => $this->errorMsg));
+ return new JSONResponse(
+ array("status" => false, "msg" => $this->errorMsg),
+ Http::STATUS_BAD_REQUEST
+ );
}
$this->smsMapper->writeToDB($this->userId, $smsDatas);
@@ -90,8 +93,11 @@ class ApiController extends Controller {
* @return JSONResponse
*/
public function replace($smsCount, $smsDatas) {
- if ($this->checkPushStructure($smsCount, $smsDatas) === false) {
- return new JSONResponse(array("status" => false, "msg" => $this->errorMsg));
+ if ($this->checkPushStructure($smsCount, $smsDatas) === false) {
+ return new JSONResponse(
+ array("status" => false, "msg" => $this->errorMsg),
+ Http::STATUS_BAD_REQUEST
+ );
}
$this->smsMapper->writeToDB($this->userId, $smsDatas, true);
@@ -103,7 +109,7 @@ class ApiController extends Controller {
* @param $smsDatas
* @return bool
*/
- private function checkPushStructure ($smsCount, $smsDatas) {
+ private function checkPushStructure (&$smsCount, &$smsDatas) {
if ($smsCount === NULL) {
$this->errorMsg = "Error: smsCount field is NULL";
return false;