From 58a04ce1a54a56d12e1a1af7badf02fc924a9db6 Mon Sep 17 00:00:00 2001 From: Satsuki Yanagi <17376330+u1-liquid@users.noreply.github.com> Date: Sun, 5 May 2019 04:04:30 +0900 Subject: [PATCH] =?UTF-8?q?=E3=83=AD=E3=82=B0=E3=82=A2=E3=82=A6=E3=83=88?= =?UTF-8?q?=E3=81=AE=E5=87=A6=E7=90=86=E3=81=A8=E5=A4=96=E9=83=A8=E3=82=B5?= =?UTF-8?q?=E3=83=BC=E3=83=93=E3=82=B9=E9=80=A3=E6=90=BAView=E3=81=8C?= =?UTF-8?q?=E3=82=BB=E3=83=83=E3=82=B7=E3=83=A7=E3=83=B3=E3=82=AF=E3=83=83?= =?UTF-8?q?=E3=82=AD=E3=83=BC=E3=82=92=E4=BD=9C=E3=82=89=E3=81=AA=E3=81=84?= =?UTF-8?q?=E3=82=88=E3=81=86=E3=81=AB=20(#4856)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../app/common/views/components/settings/integration.vue | 6 +++++- src/client/app/store.ts | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/client/app/common/views/components/settings/integration.vue b/src/client/app/common/views/components/settings/integration.vue index b91880679..8ac0c134c 100644 --- a/src/client/app/common/views/components/settings/integration.vue +++ b/src/client/app/common/views/components/settings/integration.vue @@ -54,7 +54,11 @@ export default Vue.extend({ }, mounted() { - document.cookie = `i=${this.$store.state.i.token}`; + if (!document.cookie.match(/i=(\w+)/)) { + document.cookie = `i=${this.$store.state.i.token}; path=/;` + + ` domain=${document.location.hostname}; max-age=31536000;` + + (document.location.protocol.startsWith('https') ? ' secure' : ''); + } this.$watch('$store.state.i', () => { if (this.$store.state.i.twitter) { if (this.twitterForm) this.twitterForm.close(); diff --git a/src/client/app/store.ts b/src/client/app/store.ts index a6f2a0b00..b137f7998 100644 --- a/src/client/app/store.ts +++ b/src/client/app/store.ts @@ -126,7 +126,7 @@ export default (os: MiOS) => new Vuex.Store({ logout(ctx) { ctx.commit('updateI', null); - document.cookie = 'i=;'; + document.cookie = `i=; max-age=0; domain=${document.location.hostname}`; localStorage.removeItem('i'); },