mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-18 07:07:35 +01:00
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:
@@ -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';
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user