diff --git a/apps/maarch_entreprise/index.php b/apps/maarch_entreprise/index.php
index abb911e3d80eb18fd8482d887700c7ae12195915..e11cc781c4407f8d184d21cbc2fbfeea043ab656 100755
--- a/apps/maarch_entreprise/index.php
+++ b/apps/maarch_entreprise/index.php
@@ -185,21 +185,24 @@ if ($_REQUEST['page'] && empty($_REQUEST['triggerAngular'])) {
         exit();
     }
     $core->load_lang();
+
+
+    /**
+     * [New Authentication System]
+     */
+    if ($_REQUEST['page'] <> 'login' && $_REQUEST['page'] <> 'log' && $_REQUEST['page'] <> 'logout') {
+        $cookie = \SrcCore\models\AuthenticationModel::getCookieAuth();
+        if (!empty($cookie) && \SrcCore\models\AuthenticationModel::cookieAuthentication($cookie)) {
+            \SrcCore\models\AuthenticationModel::setCookieAuth(['userId' => $cookie['userId']]);
+        } else {
+            header('location: index.php?display=true&page=logout&logout=true');
+        }
+    }
+
     //INSERT PART OF PAGE
     if (isset($_REQUEST['display'])) {
         $core->insert_page();
         exit();
-    } else {
-        // RESET SESSION TIME
-        ?>
-        <script>
-            var element = document;
-            element.addEventListener('click', function() {
-                window.clearTimeout(window.chronoExpiration);
-                window.chronoExpiration=window.setTimeout('redirect_to_url(\'<?php echo $_SESSION['config']['businessappurl']; ?>index.php?display=true&page=logout&logout=true\')', '<?php echo $_SESSION['config']['cookietime']; ?>'*60*1000);
-            });
-        </script>
-        <?php
     }
 
     //DISPLAY FULL PAGE
@@ -213,22 +216,11 @@ if ($_REQUEST['page'] && empty($_REQUEST['triggerAngular'])) {
     $core->load_html();
     $core->load_header();
 
+    
     /**
-     * [New Authentication System]
-     */
-    $cookie = \SrcCore\models\AuthenticationModel::getCookieAuth();
-    if (!empty($cookie) && \SrcCore\models\AuthenticationModel::cookieAuthentication($cookie)) {
-        \SrcCore\models\AuthenticationModel::setCookieAuth(['userId' => $cookie['userId']]);
-    } else {
-        header('location: index.php?display=true&page=logout&logout=true');
-    }
-
-    /**
-     * [Initialize session expiration]
+     * [Initialize cookie expiration]
      */
-    $time = $core->get_session_time_expire();
-    $urlLogout = $_SESSION['config']['businessappurl'].'index.php?display=true&page=logout&logout=true';
-    echo "<script>session_expirate('{$time}','{$urlLogout}');</script>";
+    echo "<script>checkCookieAuth();</script>";
 
     if (isset($_GET['body_loaded'])) {
         echo '<body style="background:#f2f2f2;" id="maarch_body">';
@@ -330,23 +322,6 @@ if ($_REQUEST['page'] && empty($_REQUEST['triggerAngular'])) {
     echo '</html>';
     exit();
 } else {
-    //V2
-    ?>
-    <link rel="stylesheet" href="../../node_modules/@fortawesome/fontawesome-free/css/all.css" media="screen" />
-    <link rel="stylesheet" href="css/font-awesome-maarch/css/font-maarch.css" media="screen" />
-    <script src='../../node_modules/jquery/dist/jquery.min.js'></script>
-    <script src='../../node_modules/core-js/client/shim.js'></script>
-    <script src='../../node_modules/zone.js/dist/zone.min.js'></script>
-    <script src='../../node_modules/bootstrap/dist/js/bootstrap.min.js'></script>
-    <script src='../../node_modules/chart.js/Chart.min.js'></script>
-    <script src='../../node_modules/tinymce/tinymce.min.js'></script>
-    <script src='../../node_modules/jquery.nicescroll/jquery.nicescroll.min.js'></script>
-    <script src='../../node_modules/tooltipster/dist/js/tooltipster.bundle.min.js'></script>
-    <script src='../../node_modules/jquery-typeahead/dist/jquery.typeahead.min.js'></script> 
-    <script src='../../node_modules/chosen-js/chosen.jquery.min.js'></script>
-    <script src='../../node_modules/jstree-bootstrap-theme/dist/jstree.js'></script>
-    <script src='js/angularFunctions.js'></script>
-    <?php
     $cookie = \SrcCore\models\AuthenticationModel::getCookieAuth();
     if (empty($cookie)) {
         header('location: index.php?display=true&page=logout&logout=true');
diff --git a/apps/maarch_entreprise/js/angularFunctions.js b/apps/maarch_entreprise/js/angularFunctions.js
index c5eb8e9a278177f7bd531675b60ec563162640cf..eb0c17c0ebee8c6b60261f1b92da834d69758053 100755
--- a/apps/maarch_entreprise/js/angularFunctions.js
+++ b/apps/maarch_entreprise/js/angularFunctions.js
@@ -1,6 +1,8 @@
 var $j = jQuery.noConflict();
 var angularGlobals = {};
 var alreadyLoaded = false;
+var cookieExpiration;
+
 function triggerAngular(locationToGo) {
     var myApp = $j('<my-app style="height: 100%;display:none;"></my-app>');
     myApp.appendTo('body');
@@ -8,19 +10,20 @@ function triggerAngular(locationToGo) {
     $j('body').removeAttr("style");
     $j('body').removeAttr("onload");
     $j.ajax({
-        url      : '../../rest/initialize',
-        type     : 'GET',
-        dataType : 'json',
-        success: function(answer) {
+        url: '../../rest/initialize',
+        type: 'GET',
+        dataType: 'json',
+        success: function (answer) {
             angularGlobals = answer;
 
             if (!alreadyLoaded) {
                 var head = document.getElementsByTagName('head')[0];
+                $j('body').css({'margin':'0','padding':'0'});
                 $j('#maarch_content').remove();
-                var loading = $j('<div id="loadingAngularContent" style="color: #666;height: 100%;padding: 0;margin: 0;display: flex;align-items: center;justify-content: center;"><div style="opacity:0.5;display: flex;justify-content: center;padding: 5px;height: 20px;margin: 10px;line-height: 20px;font-weight: bold;font-size: 2em;text-align: center;"><div class="lds-ring"><div></div><div></div><div></div><div></div></div><div style=\'font-family: Roboto,"Helvetica Neue",sans-serif;\'>Chargement en cours ...</div></div></div>');
+                var loading = $j('<div id="loadingAngularContent" style="position:absolute;width:100%;color: #666;height: 100%;padding: 0;margin: 0;display: flex;align-items: center;justify-content: center;"><div style="opacity:0.5;display: flex;justify-content: center;padding: 5px;height: 20px;margin: 10px;line-height: 20px;font-weight: bold;font-size: 2em;text-align: center;"><div class="lds-ring"><div></div><div></div><div></div><div></div></div><div style=\'font-family: Roboto,"Helvetica Neue",sans-serif;\'>Chargement en cours ...</div></div></div>');
                 loading.appendTo('body');
 
-                answer['scriptsToinject'].forEach(function(element, i) {
+                answer['scriptsToinject'].forEach(function (element, i) {
                     var script = document.createElement('script');
                     script.type = 'text/javascript';
                     script.src = "../../dist/" + element;
@@ -60,41 +63,39 @@ function changeLocationToAngular(locationToGo) {
 function lockDocument(resId) {
     $j.ajax({
         url: 'index.php?display=true&dir=actions&page=docLocker',
-        type : 'POST',
+        type: 'POST',
         data: {
-            AJAX_CALL  : true,
-            lock       : true,
-            res_id     : resId
+            AJAX_CALL: true,
+            lock: true,
+            res_id: resId
         },
-        success: function(result){
-        }
+        success: function (result) {}
     });
 }
 
 function unlockDocument(resId) {
     $j.ajax({
         url: 'index.php?display=true&dir=actions&page=docLocker',
-        type : 'POST',
+        type: 'POST',
         data: {
-            AJAX_CALL  : true,
-            unlock     : true,
-            res_id     : resId
+            AJAX_CALL: true,
+            unlock: true,
+            res_id: resId
         },
-        success: function(result) {
-        }
+        success: function (result) {}
     });
 }
 
 function islockForSignatureBook(resId, basketId, groupId) {
     $j.ajax({
         url: 'index.php?display=true&dir=actions&page=docLocker',
-        type : 'POST',
+        type: 'POST',
         data: {
-            AJAX_CALL  : true,
-            isLock     : true,
-            res_id     : resId
+            AJAX_CALL: true,
+            isLock: true,
+            res_id: resId
         },
-        success: function(result) {
+        success: function (result) {
             var response = JSON.parse(result);
 
             if (response.lock) {
@@ -127,17 +128,18 @@ var disablePrototypeJS = function (method, pluginsToDisable) {
 
 function setAttachmentInSignatureBook(id, isVersion) {
     $j.ajax({
-        url      : '../../rest/attachments/' + id + '/inSignatureBook',
-        type     : 'PUT',
-        dataType : 'json',
+        url: '../../rest/attachments/' + id + '/inSignatureBook',
+        type: 'PUT',
+        dataType: 'json',
         data: {
-            isVersion   : isVersion
+            isVersion: isVersion
         },
-        success: function(answer) {
+        success: function (answer) {
             if (typeof window.parent['angularSignatureBookComponent'] !== "undefined") {
                 window.parent.angularSignatureBookComponent.componentAfterAttach("left");
             }
-        }, error: function(err) {
+        },
+        error: function (err) {
             alert("Une erreur s'est produite : " + err.responseJSON.exception[0].message);
         }
     });
@@ -146,17 +148,15 @@ function setAttachmentInSignatureBook(id, isVersion) {
 function setSessionForSignatureBook(resId) {
     $j.ajax({
         url: 'index.php?display=true&dir=actions&page=setSession',
-        type : 'POST',
+        type: 'POST',
         data: {
-            resId     : resId
+            resId: resId
         },
-        success: function(result) {
-        }
+        success: function (result) {}
     });
 }
 
-function displayThumbnail(resId)
-{
+function displayThumbnail(resId) {
     $j('#thumb_' + resId).html('<img src="../../rest/res/' + resId + '/thumbnail">');
 }
 
@@ -177,6 +177,7 @@ $j(document).keydown(function (e) {
             var pos = 100;
             var rot = 0;
             var id = setInterval(frame, 10);
+
             function frame() {
                 if (pos > 1400) {
                     clearInterval(id);
@@ -187,24 +188,30 @@ $j(document).keydown(function (e) {
                     pos += 5;
                     konami.css('left', pos + 'px');
                     if (pos == 0 || pos == 400) {
-                        konami.css({'-webkit-transform' : 'rotate(-15deg)',
-                        '-moz-transform' : 'rotate(-15deg)',
-                        '-ms-transform' : 'rotate(-15deg)',
-                        'transform' : 'rotate(-15deg)'});
+                        konami.css({
+                            '-webkit-transform': 'rotate(-15deg)',
+                            '-moz-transform': 'rotate(-15deg)',
+                            '-ms-transform': 'rotate(-15deg)',
+                            'transform': 'rotate(-15deg)'
+                        });
                     } else if (pos == 200 || pos == 600) {
-                        konami.css({'-webkit-transform' : 'rotate(15deg)',
-                        '-moz-transform' : 'rotate((15degg)',
-                        '-ms-transform' : 'rotate((15deg)',
-                        'transform' : 'rotate((15deg)'});  
+                        konami.css({
+                            '-webkit-transform': 'rotate(15deg)',
+                            '-moz-transform': 'rotate((15degg)',
+                            '-ms-transform': 'rotate((15deg)',
+                            'transform': 'rotate((15deg)'
+                        });
                     }
-                    if(pos > 800) {
+                    if (pos > 800) {
                         rot += 5;
-                        konami.css({'-webkit-transform' : 'rotate('+ rot +'deg)',
-                        '-moz-transform' : 'rotate('+ rot +'deg)',
-                        '-ms-transform' : 'rotate('+ rot +'deg)',
-                        'transform' : 'rotate('+ rot +'deg)'});
+                        konami.css({
+                            '-webkit-transform': 'rotate(' + rot + 'deg)',
+                            '-moz-transform': 'rotate(' + rot + 'deg)',
+                            '-ms-transform': 'rotate(' + rot + 'deg)',
+                            'transform': 'rotate(' + rot + 'deg)'
+                        });
                     }
-                    
+
                 }
             }
             koNb = 0;
@@ -213,3 +220,32 @@ $j(document).keydown(function (e) {
         koNb = 0;
     }
 });
+
+function getCookie(name) {
+    var nameEQ = name + "=";
+    var ca = document.cookie.split(';');
+    for (var i = 0; i < ca.length; i++) {
+        var c = ca[i];
+        while (c.charAt(0) == ' ') c = c.substring(1, c.length);
+        if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length, c.length);
+    }
+    return null;
+}
+
+/**
+ * Logout if cookie auth is expired (checked every minute)
+ *
+ */
+function checkCookieAuth() {
+    $cookieAuth = getCookie('maarchCourrierAuth');
+
+    if ($cookieAuth === null) {
+        var localTime = new Date();
+        var hours = localTime.getHours();
+        var minutes = localTime.getMinutes();
+        var text = hours + ":" + minutes;
+        alert('Vous avez été déconnecté à ' + text + ' (temps d\'inactivité trop long)\n\nVeuillez vous reconnecter');
+        location.href = 'index.php?display=true&page=logout&logout=true';
+    }
+    cookieExpiration = setTimeout('checkCookieAuth()', 1 * 60 * 1000);
+}
\ No newline at end of file
diff --git a/apps/maarch_entreprise/js/functions.js b/apps/maarch_entreprise/js/functions.js
index 3cc461a14a73f493d21c11b858c2392bf0beb840..dd612c04c3e7f3d0bbaaeb10c4ed4b67a65b9272 100755
--- a/apps/maarch_entreprise/js/functions.js
+++ b/apps/maarch_entreprise/js/functions.js
@@ -1,5 +1,4 @@
 var isAlreadyClick = false;
-var chronoExpiration;
 
 page_result_final = '';
 
@@ -850,31 +849,6 @@ function getWindowSize() {
     return [width, height];
 }
 
-
-/**
- * Redirect to a given url
- *
- * @param url String Url to redirect to
- */
-function redirect_to_url(url) {
-    var localTime = new Date();
-    var hours = localTime.getHours();
-    var minutes = localTime.getMinutes();
-    var text = hours + ":" + minutes;
-    alert('Vous avez été déconnecté à ' + text + ' (temps d\'inactivité trop long)\n\nVeuillez vous reconnecter');
-    location.href = url;
-}
-
-/**
- * redirect to a given url when the session expirates
- *
- * @param expiration Integer Expiration time (in minutes))
- * @param url String Url to redirect to
- */
-function session_expirate(expiration, url) {
-    chronoExpiration = setTimeout('redirect_to_url(\'' + url + '\')', expiration * 60 * 1000);
-}
-
 /*************** Tabs functions *****************/
 
 function opentab(eleframe, url) {
diff --git a/modules/attachments/attachments_content.php b/modules/attachments/attachments_content.php
index cfbd68efc5ebef8d449eede4adf6008d2acc629c..02ef0f18b6466721c86f7fb0bdf975989d8e2256 100755
--- a/modules/attachments/attachments_content.php
+++ b/modules/attachments/attachments_content.php
@@ -1409,7 +1409,5 @@ if ($mode == 'add') {
     $js .= 'setTimeout(function(){window.top.document.getElementById(\'PjDocument_0\').click()}, 1000);';
 }
 
-$js .= "setInterval(function(){window.top.clearTimeout(window.top.chronoExpiration);window.top.chronoExpiration=window.top.setTimeout('redirect_to_url(\'index.php?display=true&page=logout&logout=true\')', ".$_SESSION['config']['cookietime'].'*60*1000); }, 60000);';
-
 echo '{status : '.$status.", content : '".addslashes(_parse($content))."', error : '".addslashes($error)."', exec_js : '".addslashes($js)."'}";
 exit();
diff --git a/modules/content_management/applet_popup_launcher.php b/modules/content_management/applet_popup_launcher.php
index 8b87afb292c8d7ec4ee831d1279e969d7674a414..81ad4c84fff043c7705b8ff18f8658fc49a69b47 100755
--- a/modules/content_management/applet_popup_launcher.php
+++ b/modules/content_management/applet_popup_launcher.php
@@ -88,8 +88,6 @@ $uniqueId = (isset($_REQUEST['transmissionNumber']) ? $_REQUEST['transmissionNum
                     ?>&custom_override_id=<?php 
                     functions::xecho($_SESSION['custom_override_id']);
                     ?>');
-                //reset auto deco
-                setInterval(function(){ window.opener.clearTimeout(window.opener.chronoExpiration);window.opener.chronoExpiration=window.opener.setTimeout('redirect_to_url(\'<?php echo $_SESSION['config']['businessappurl']; ?>index.php?display=true&page=logout&logout=true\')', '<?php echo $_SESSION['config']['cookietime']; ?>'*60*1000); }, 3000);
             </script>
             <style type="text/css">#CMApplet{width: 100%;height: 100%;text-align: center;padding: 0px;margin: 0px;padding-top: 10px;}</style>
         </div>
diff --git a/src/core/models/AuthenticationModel.php b/src/core/models/AuthenticationModel.php
index ffd96cf0b2a6a0b9b2a7d7976c58b15e99cf3165..30dec779e5deee0d7abeac1966db4b417f34c92e 100644
--- a/src/core/models/AuthenticationModel.php
+++ b/src/core/models/AuthenticationModel.php
@@ -110,7 +110,7 @@ class AuthenticationModel
         ]);
 
         $cookieData = json_encode(['userId' => $args['userId'], 'cookieKey' => $cookieKey]);
-        setcookie('maarchCourrierAuth', base64_encode($cookieData), $cookieTime, $cookiePath, '', false, true);
+        setcookie('maarchCourrierAuth', base64_encode($cookieData), $cookieTime, $cookiePath, '', false, false);
 
         return true;
     }
diff --git a/src/core/models/CoreConfigModel.php b/src/core/models/CoreConfigModel.php
index effeb29fb958fab4d83b75b6a68306cb8b0ae3f4..984c458a675930235d5bde597d92dec654bfc6e0 100644
--- a/src/core/models/CoreConfigModel.php
+++ b/src/core/models/CoreConfigModel.php
@@ -232,7 +232,30 @@ class CoreConfigModel
         $structure .= "<meta charset='utf-8'>";
         $structure .= "<title>{$appName}</title>";
         $structure .= "<link rel='icon' href='../../{$favIconPath}' />";
+
+        /* CSS PARTS */
+        $structure .= '<link rel="stylesheet" href="../../node_modules/@fortawesome/fontawesome-free/css/all.css" media="screen" />';
+        $structure .= '<link rel="stylesheet" href="css/font-awesome-maarch/css/font-maarch.css" media="screen" />';
+
         $structure .= '</head>';
+
+        /* SCRIPS PARTS */
+        $structure .= "<script src='../../node_modules/jquery/dist/jquery.min.js'></script>";
+        $structure .= "<script src='../../node_modules/core-js/client/shim.js'></script>";
+        $structure .= "<script src='../../node_modules/zone.js/dist/zone.min.js'></script>";
+        $structure .= "<script src='../../node_modules/bootstrap/dist/js/bootstrap.min.js'></script>";
+        $structure .= "<script src='../../node_modules/chart.js/Chart.min.js'></script>";
+        $structure .= "<script src='../../node_modules/tinymce/tinymce.min.js'></script>";
+        $structure .= "<script src='../../node_modules/jquery.nicescroll/jquery.nicescroll.min.js'></script>";
+        $structure .= "<script src='../../node_modules/tooltipster/dist/js/tooltipster.bundle.min.js'></script>";
+        $structure .= "<script src='../../node_modules/jquery-typeahead/dist/jquery.typeahead.min.js'></script> ";
+        $structure .= "<script src='../../node_modules/chosen-js/chosen.jquery.min.js'></script>";
+        $structure .= "<script src='../../node_modules/jstree-bootstrap-theme/dist/jstree.js'></script>";
+        $structure .= "<script src='js/angularFunctions.js'></script>";
+
+        /* AUTO DISCONNECT */
+        $structure .= "<script>checkCookieAuth();</script>";
+        
         $structure .= '<body>';
         $structure .= '</body>';
         $structure .= '</html>';