]> www.vanbest.org Git - motioneye-debian/commitdiff
auth cookie names are now a bit more specific
authorCalin Crisan <ccrisan@gmail.com>
Sun, 28 May 2017 10:19:53 +0000 (13:19 +0300)
committerCalin Crisan <ccrisan@gmail.com>
Sun, 28 May 2017 10:19:53 +0000 (13:19 +0300)
motioneye/static/js/main.js

index 6de861a1c49896a04c9ca6d9260c661f2ce9c300..ac473f2efefc7301d4b8a0cea05dd6cd15a16066 100644 (file)
@@ -1,4 +1,7 @@
 
+var USERNAME_COOKIE = 'meye_username';
+var PASSWORD_COOKIE = 'meye_password_hash';
+
 var pushConfigs = {};
 var pushConfigReboot = false;
 var refreshDisabled = {}; /* dictionary indexed by cameraId, tells if refresh is disabled for a given camera */
@@ -499,10 +502,6 @@ function setCookie(name, value, days) {
     document.cookie = name + '=' + value + '; ' + expires + '; path=/';
 }
 
-function remCookie(name) {
-    document.cookie = name + '=; expires=Thu, 01 Jan 1970 00:00:01 GMT;';
-}
-
 function showErrorMessage(message) {
     if (message == null || message == true) {
         message = 'An error occurred. Refreshing is recommended.';
@@ -512,7 +511,7 @@ function showErrorMessage(message) {
 }
 
 function doLogout() {
-    setCookie('username', '_');
+    setCookie(USERNAME_COOKIE, '_');
     window.location.reload(true);
 }
 
@@ -3392,8 +3391,8 @@ function runLoginDialog(retry) {
                 window._loginDialogSubmitted = true;
                 
                 if (rememberCheck[0].checked) {
-                    setCookie('username', window.username, /* days = */ 3650);
-                    setCookie('passwordHash', window.passwordHash, /* days = */ 3650);
+                    setCookie(USERNAME_COOKIE, window.username, /* days = */ 3650);
+                    setCookie(PASSWORD_COOKIE, window.passwordHash, /* days = */ 3650);
                 }
                 
                 form.submit();
@@ -4991,8 +4990,8 @@ $(document).ready(function () {
         window.basePath = splitUrl(qualifyPath('')).baseUrl;
 
         /* restore the username from cookie */
-        window.username = getCookie('username');
-        window.passwordHash = getCookie('passwordHash');
+        window.username = getCookie(USERNAME_COOKIE);
+        window.passwordHash = getCookie(PASSWORD_COOKIE);
     }
     
     /* open/close settings */