mirror of
https://github.com/LBRYFoundation/lbry-desktop.git
synced 2025-08-31 17:31:27 +00:00
add path when deleting cookie so logout always works
This commit is contained in:
parent
0fb4f6f96d
commit
8f42280969
1 changed files with 4 additions and 3 deletions
|
@ -11,7 +11,7 @@ function setCookie(name: string, value: string, days: number) {
|
||||||
expires = '; expires=' + date.toUTCString();
|
expires = '; expires=' + date.toUTCString();
|
||||||
}
|
}
|
||||||
|
|
||||||
document.cookie = `${name}=${value || ''}${expires}; path=/`;
|
document.cookie = `${name}=${value || ''}${expires}; path=/;samesite=strict;`;
|
||||||
}
|
}
|
||||||
|
|
||||||
function getCookie(name: string) {
|
function getCookie(name: string) {
|
||||||
|
@ -32,7 +32,7 @@ function getCookie(name: string) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function deleteCookie(name: string) {
|
function deleteCookie(name: string) {
|
||||||
document.cookie = name + '=; Max-Age=-99999999;';
|
document.cookie = name + '=; Max-Age=-99999999; path=/;';
|
||||||
}
|
}
|
||||||
|
|
||||||
export const setSavedPassword = (value?: string, saveToDisk: boolean) => {
|
export const setSavedPassword = (value?: string, saveToDisk: boolean) => {
|
||||||
|
@ -106,6 +106,8 @@ export const setAuthToken = (value: string) => {
|
||||||
|
|
||||||
export const deleteAuthToken = () => {
|
export const deleteAuthToken = () => {
|
||||||
return new Promise<*>(resolve => {
|
return new Promise<*>(resolve => {
|
||||||
|
deleteCookie('auth_token');
|
||||||
|
|
||||||
// @if TARGET='app'
|
// @if TARGET='app'
|
||||||
ipcRenderer.once('delete-auth-token-response', (event, success) => {
|
ipcRenderer.once('delete-auth-token-response', (event, success) => {
|
||||||
resolve();
|
resolve();
|
||||||
|
@ -113,7 +115,6 @@ export const deleteAuthToken = () => {
|
||||||
ipcRenderer.send('delete-auth-token');
|
ipcRenderer.send('delete-auth-token');
|
||||||
// @endif;
|
// @endif;
|
||||||
|
|
||||||
deleteCookie('auth_token');
|
|
||||||
// @if TARGET='web'
|
// @if TARGET='web'
|
||||||
resolve();
|
resolve();
|
||||||
// @endif
|
// @endif
|
||||||
|
|
Loading…
Add table
Reference in a new issue