From: Calin Crisan Date: Sun, 28 May 2017 10:19:53 +0000 (+0300) Subject: auth cookie names are now a bit more specific X-Git-Url: http://www.vanbest.org/gitweb/?a=commitdiff_plain;h=2c0f58626a3510daf0ec73a1f33ae22f21d41b9e;p=motioneye-debian auth cookie names are now a bit more specific --- diff --git a/motioneye/static/js/main.js b/motioneye/static/js/main.js index 6de861a..ac473f2 100644 --- a/motioneye/static/js/main.js +++ b/motioneye/static/js/main.js @@ -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 */