From 710d418558c5a5267548dc0c4b62f0093b0b7794 Mon Sep 17 00:00:00 2001
From: Damien <damien.burel@maarch.org>
Date: Wed, 26 Jun 2019 16:20:26 +0200
Subject: [PATCH] FIX from merge request

---
 config/config.xml.default                                 | 2 +-
 phpunit.xml                                               | 3 ++-
 .../configuration/controllers/ConfigurationController.php | 2 +-
 src/app/user/controllers/UserController.php               | 7 ++++++-
 .../app/administration/sendmail/sendmail.component.ts     | 8 --------
 5 files changed, 10 insertions(+), 12 deletions(-)

diff --git a/config/config.xml.default b/config/config.xml.default
index 7d63ce8ac7..bed53b6c2d 100755
--- a/config/config.xml.default
+++ b/config/config.xml.default
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="utf-8"?>
 <ROOT>
     <config>
-        <sessionTime>1440</sessionTime> <!-- minutes -->
+        <sessionTime>10080</sessionTime> <!-- minutes -->
         <timezone>Europe/Paris</timezone>
         <customLangPathDirectory></customLangPathDirectory>
     </config>
diff --git a/phpunit.xml b/phpunit.xml
index 946f1a378d..7de1cc5483 100755
--- a/phpunit.xml
+++ b/phpunit.xml
@@ -2,12 +2,13 @@
 <phpunit colors="true" bootstrap="test/unitTests/define.php">
     <testsuites>
         <testsuite name="Maarch Parapheur Test Suite">
-            <!-- <file>test/unitTests/core/AuthenticationControllerTest.php</file> -->
+            <file>test/unitTests/core/AuthenticationControllerTest.php</file>
             <file>test/unitTests/core/PasswordControllerTest.php</file>
             <file>test/unitTests/app/user/UserControllerTest.php</file>
             <file>test/unitTests/app/configuration/ConfigurationControllerTest.php</file>
             <file>test/unitTests/app/document/DocumentControllerTest.php</file>
             <file>test/unitTests/app/group/GroupControllerTest.php</file>
+            <file>test/unitTests/app/history/HistoryControllerTest.php</file>
         </testsuite>
     </testsuites>
     <filter>
diff --git a/src/app/configuration/controllers/ConfigurationController.php b/src/app/configuration/controllers/ConfigurationController.php
index b62ebb1ee2..165dfec5f6 100755
--- a/src/app/configuration/controllers/ConfigurationController.php
+++ b/src/app/configuration/controllers/ConfigurationController.php
@@ -188,7 +188,7 @@ class ConfigurationController
                 return $response->withStatus(400)->withJson(['errors' => $check['errors']]);
             }
 
-            if ($body['value']['auth'] && empty($body['value']['password']) && !empty($configuration)) {
+            if ($body['value']['auth'] && empty($body['value']['password'])) {
                 $configuration['value'] = json_decode($configuration['value'], true);
                 if (!empty($configuration['value']['password'])) {
                     $body['value']['password'] = $configuration['value']['password'];
diff --git a/src/app/user/controllers/UserController.php b/src/app/user/controllers/UserController.php
index c6022f92ab..4dd86e26b9 100755
--- a/src/app/user/controllers/UserController.php
+++ b/src/app/user/controllers/UserController.php
@@ -322,6 +322,11 @@ class UserController
             return $response->withStatus(400)->withJson(['errors' => 'Body notifications is empty or not a boolean']);
         }
 
+        $user = UserModel::getById(['id' => $args['id'], 'select' => ['firstname', 'lastname']]);
+        if (empty($user)) {
+            return $response->withStatus(400)->withJson(['errors' => 'User does not exist']);
+        }
+
         $preferences = json_encode([
             'lang'          => $body['lang'],
             'writingMode'   => $body['writingMode'],
@@ -344,7 +349,7 @@ class UserController
             'objectType'    => 'users',
             'objectId'      => $args['id'],
             'type'          => 'MODIFICATION',
-            'message'       => "{userUpdated} : {$body['firstname']} {$body['lastname']}"
+            'message'       => "{userUpdated} : {$user['firstname']} {$user['lastname']}"
         ]);
 
         return $response->withStatus(204);
diff --git a/src/frontend/app/administration/sendmail/sendmail.component.ts b/src/frontend/app/administration/sendmail/sendmail.component.ts
index 5f683017ea..869336acc0 100644
--- a/src/frontend/app/administration/sendmail/sendmail.component.ts
+++ b/src/frontend/app/administration/sendmail/sendmail.component.ts
@@ -172,14 +172,6 @@ export class SendmailComponent implements OnInit {
                             error: true
                         };
                     }
-                },
-                error: err => {
-                    this.emailSendResult = {
-                        icon: 'fa-times red',
-                        msg: 'lang.emailSendFailed',
-                        debug: err.error.errors,
-                        error: true
-                    };
                 }
             });
     }
-- 
GitLab