1
0
mirror of https://github.com/misskey-dev/misskey synced 2024-11-27 14:28:59 +09:00

ログアウトの処理と外部サービス連携Viewがセッションクッキーを作らないように (#4856)

This commit is contained in:
Satsuki Yanagi 2019-05-05 04:04:30 +09:00 committed by syuilo
parent c6249b82d4
commit 58a04ce1a5
2 changed files with 6 additions and 2 deletions

View File

@ -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();

View File

@ -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');
},