mirror of
https://github.com/MisskeyIO/misskey
synced 2024-12-01 00:08:24 +09:00
Cookieを使わないように
This commit is contained in:
parent
f257853906
commit
4bbb7eded3
@ -67,7 +67,8 @@ export default Vue.extend({
|
|||||||
username: this.username,
|
username: this.username,
|
||||||
password: this.password,
|
password: this.password,
|
||||||
token: this.user && this.user.twoFactorEnabled ? this.token : undefined
|
token: this.user && this.user.twoFactorEnabled ? this.token : undefined
|
||||||
}, true).then(() => {
|
}, true).then(res => {
|
||||||
|
localStorage.setItem('i', res.i);
|
||||||
location.reload();
|
location.reload();
|
||||||
}).catch(() => {
|
}).catch(() => {
|
||||||
alert(this.$t('login-failed'));
|
alert(this.$t('login-failed'));
|
||||||
|
@ -190,8 +190,8 @@ export default class MiOS extends EventEmitter {
|
|||||||
this.store.dispatch('mergeMe', freshData);
|
this.store.dispatch('mergeMe', freshData);
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
// Get token from cookie
|
// Get token from cookie or localStorage
|
||||||
const i = (document.cookie.match(/i=(!\w+)/) || [null, null])[1];
|
const i = (document.cookie.match(/i=(!\w+)/) || [null, null])[1] || localStorage.getItem('i');
|
||||||
|
|
||||||
fetchme(i, me => {
|
fetchme(i, me => {
|
||||||
if (me) {
|
if (me) {
|
||||||
|
@ -11,11 +11,3 @@ if (!('fetch' in window)) {
|
|||||||
'Your browser (or your OS) seems outdated. ' +
|
'Your browser (or your OS) seems outdated. ' +
|
||||||
'To run Misskey, please update your browser to latest version or try other browsers.');
|
'To run Misskey, please update your browser to latest version or try other browsers.');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check whether cookie enabled
|
|
||||||
if (!navigator.cookieEnabled) {
|
|
||||||
alert(
|
|
||||||
'Misskeyを利用するにはCookieを有効にしてください。' +
|
|
||||||
'\n\n' +
|
|
||||||
'To use Misskey, please enable Cookie.');
|
|
||||||
}
|
|
||||||
|
@ -129,6 +129,7 @@ export default (os: MiOS) => new Vuex.Store({
|
|||||||
logout(ctx) {
|
logout(ctx) {
|
||||||
ctx.commit('updateI', null);
|
ctx.commit('updateI', null);
|
||||||
document.cookie = `i=; domain=${hostname}; expires=Thu, 01 Jan 1970 00:00:01 GMT;`;
|
document.cookie = `i=; domain=${hostname}; expires=Thu, 01 Jan 1970 00:00:01 GMT;`;
|
||||||
|
localStorage.removeItem('i');
|
||||||
},
|
},
|
||||||
|
|
||||||
mergeMe(ctx, me) {
|
mergeMe(ctx, me) {
|
||||||
|
@ -21,6 +21,7 @@ export default function(ctx: Koa.Context, user: ILocalUser, redirect = false) {
|
|||||||
|
|
||||||
ctx.redirect(config.url);
|
ctx.redirect(config.url);
|
||||||
} else {
|
} else {
|
||||||
ctx.status = 204;
|
ctx.body = { i: user.token };
|
||||||
|
ctx.status = 200;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user