]> Untitled Git - lemmy-ui.git/commitdiff
Fix workaround for broken logout (#836)
authorsam365724 <111515092+sam365724@users.noreply.github.com>
Wed, 2 Nov 2022 18:32:30 +0000 (19:32 +0100)
committerGitHub <noreply@github.com>
Wed, 2 Nov 2022 18:32:30 +0000 (14:32 -0400)
Use hostname without port for setting empty cookie, avoids error in browser:
Cookie “jwt” has been rejected for invalid domain.

src/shared/services/UserService.ts

index 8d591cc3ed3c0ffa2466b878683a7c374c227dbd..b97d5063f0b95d953ae0a30d25922cc65788fa35 100644 (file)
@@ -52,7 +52,7 @@ export class UserService {
     this.jwtInfo = None;
     this.myUserInfo = None;
     IsomorphicCookie.remove("jwt"); // TODO is sometimes unreliable for some reason
-    document.cookie = "jwt=; Max-Age=0; path=/; domain=" + location.host;
+    document.cookie = "jwt=; Max-Age=0; path=/; domain=" + location.hostname;
     location.reload();
   }