Remove cookies on clearing browser data (#8135)

* remove cookies

* update cookie removal

* Remove + and add link

* Fix tests

* Add condition

* update strings
This commit is contained in:
AccioBooks
2016-10-25 04:53:56 -05:00
committed by Alys
parent f1bb2db73b
commit be3f61a94b
2 changed files with 16 additions and 5 deletions

View File

@@ -11,6 +11,17 @@ angular.module('habitrpg')
$scope.logout = function() { $scope.logout = function() {
localStorage.clear(); localStorage.clear();
// Adapted from http://www.quirksmode.org/js/cookies.html
// Removes all cookies that do not have the HttpOnly flag set
var cookies = document.cookie.split(';');
for (var i = 0; i < cookies.length; i++) {
var cookieNameArray = cookies[i].match(/([^=]+)(?=\=)/);
if(cookieNameArray != null){
document.cookie = cookieNameArray[0] + '= ; expires=Thu Jan 1 00:00:00 1970 GMT; path=/';
}
}
$window.location.href = '/logout'; $window.location.href = '/logout';
}; };

View File

@@ -178,12 +178,12 @@
"terms": "Terms and Conditions", "terms": "Terms and Conditions",
"testimonialHeading": "What people say...", "testimonialHeading": "What people say...",
"tumblr": "Tumblr", "tumblr": "Tumblr",
"localStorageTryFirst": "If you are experiencing problems with Habitica, click the button below to clear local storage for this website (other websites will not be affected). You will need to log in again after doing this, so first be sure that you know your log-in details, which can be found at Settings -> <%= linkStart %>Site<%= linkEnd %>.", "localStorageTryFirst": "If you are experiencing problems with Habitica, click the button below to clear local storage and most cookies for this website (other websites will not be affected). You will need to log in again after doing this, so first be sure that you know your log-in details, which can be found at Settings -> <%= linkStart %>Site<%= linkEnd %>.",
"localStorageTryNext": "If the problem persists, please <%= linkStart %>Report a Bug<%= linkEnd %> if you haven't already.", "localStorageTryNext": "If the problem persists, please <%= linkStart %>Report a Bug<%= linkEnd %> if you haven't already.",
"localStorageClearing": "Clearing Local Storage", "localStorageClearing": "Clearing Data",
"localStorageClearingExplanation": "Your browser's local storage is being cleared. You will be logged out and redirected to the home page. Please wait.", "localStorageClearingExplanation": "Habitica's stored data is being cleared from your browser. You will be logged out and redirected to the home page. Please wait.",
"localStorageClear": "Clear Local Storage", "localStorageClear": "Clear Data",
"localStorageClearExplanation": "This button will clear local storage and log you out", "localStorageClearExplanation": "This button will clear local storage and most cookies, and log you out.",
"tutorials": "Tutorials", "tutorials": "Tutorials",
"unlockByline1": "Achieve your goals and level up.", "unlockByline1": "Achieve your goals and level up.",
"unlockByline2": "Unlock new motivational tools, such as pet collecting, random rewards, spell-casting, and more!", "unlockByline2": "Unlock new motivational tools, such as pet collecting, random rewards, spell-casting, and more!",