diff --git a/src/app/contact/controllers/ContactController.php b/src/app/contact/controllers/ContactController.php index ce7248672ae41abc2bb732e9714d537014765a43..15bb093bd4c2b0a8971feb870767e2d505db77a2 100755 --- a/src/app/contact/controllers/ContactController.php +++ b/src/app/contact/controllers/ContactController.php @@ -139,7 +139,15 @@ class ContactController if (!empty($control['errors'])) { return $response->withStatus(400)->withJson(['errors' => $control['errors']]); } - + + $currentUser = UserModel::getById(['id' => $GLOBALS['id'], 'select' => ['loginmode']]); + if (!empty($body['email']) && $currentUser['loginmode'] == 'restMode') { + $contact = ContactModel::get(['select' => ['id'], 'where' => ['email = ?'], 'data' => [$body['email']]]); + if (!empty($contact[0]['id'])) { + return $response->withJson(['id' => $contact[0]['id']]); + } + } + if (!empty($body['communicationMeans'])) { if (filter_var($body['communicationMeans'], FILTER_VALIDATE_EMAIL)) { $body['communicationMeans'] = ['email' => $body['communicationMeans']]; diff --git a/src/app/indexingModel/controllers/IndexingModelController.php b/src/app/indexingModel/controllers/IndexingModelController.php index 7ea73aedbc6169cd9f52a4364af263b0f6a1f10a..4c414a7a61c7d7230cee13ede77c3a7a48769392 100755 --- a/src/app/indexingModel/controllers/IndexingModelController.php +++ b/src/app/indexingModel/controllers/IndexingModelController.php @@ -421,7 +421,6 @@ class IndexingModelController 'where' => ['model_id = ?'], 'data' => [$args['id']] ]); - if (!empty($resources)) { return $response->withStatus(400)->withJson(['errors' => 'Model is used by at least one resource', 'lang' => 'modelUsedByResources']); }