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() {
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';
};