From 3477d58ccf17caca81dd2e5bf84e2b901322c903 Mon Sep 17 00:00:00 2001
From: Damien <damien.burel@maarch.org>
Date: Fri, 3 Apr 2020 14:32:45 +0200
Subject: [PATCH] FEAT #13667 TIME 0:35 Auth informations

---
 rest/index.php                                    |  1 +
 src/core/controllers/AuthenticationController.php | 15 ++++++++++++++-
 2 files changed, 15 insertions(+), 1 deletion(-)

diff --git a/rest/index.php b/rest/index.php
index 54169f6262a..91014da0aba 100755
--- a/rest/index.php
+++ b/rest/index.php
@@ -51,6 +51,7 @@ $app->add(function (\Slim\Http\Request $request, \Slim\Http\Response $response,
 });
 
 //Authentication
+$app->get('/authenticationInformations', \SrcCore\controllers\AuthenticationController::class . ':getInformations');
 $app->post('/authenticate', \SrcCore\controllers\AuthenticationController::class . ':authenticate');
 $app->get('/authenticate/token', \SrcCore\controllers\AuthenticationController::class . ':getRefreshedToken');
 
diff --git a/src/core/controllers/AuthenticationController.php b/src/core/controllers/AuthenticationController.php
index b7ae4ff2a38..ba47ac943d3 100755
--- a/src/core/controllers/AuthenticationController.php
+++ b/src/core/controllers/AuthenticationController.php
@@ -18,6 +18,7 @@ use Configuration\models\ConfigurationModel;
 use Email\controllers\EmailController;
 use Firebase\JWT\JWT;
 use History\controllers\HistoryController;
+use Parameter\models\ParameterModel;
 use Respect\Validation\Validator;
 use Slim\Http\Request;
 use Slim\Http\Response;
@@ -31,9 +32,21 @@ class AuthenticationController
 {
     const MAX_DURATION_TOKEN = 30; //Minutes
     const ROUTES_WITHOUT_AUTHENTICATION = [
-        'GET/jnlp/{jnlpUniqueId}', 'POST/password', 'PUT/password', 'GET/passwordRules', 'GET/onlyOffice/mergedFile', 'POST/onlyOfficeCallback'
+        'GET/authenticationInformations', 'POST/password', 'PUT/password', 'GET/passwordRules',
+        'GET/jnlp/{jnlpUniqueId}', 'GET/onlyOffice/mergedFile', 'POST/onlyOfficeCallback'
     ];
 
+    public function getInformations(Request $request, Response $response)
+    {
+//        $path = CoreConfigModel::getConfigPath();
+//        $hashedPath = md5($path);
+
+        $appName = CoreConfigModel::getApplicationName();
+        $parameter = ParameterModel::getById(['id' => 'loginpage_message', 'select' => ['param_value_string']]);
+
+        return $response->withJson(['instanceId' => null, 'applicationName' => $appName, 'loginMessage' => $parameter['param_value_string'] ?? null]);
+    }
+
     public static function authentication()
     {
         $userId = null;
-- 
GitLab