1
0
mirror of https://github.com/misskey-dev/misskey synced 2024-11-24 23:26:35 +09:00
This commit is contained in:
syuilo 2023-02-09 10:47:03 +09:00
parent 21331e53fe
commit 71dd7f89e9
2 changed files with 6 additions and 22 deletions

View File

@ -25,7 +25,7 @@ export class SigninService {
}
@bindThis
public signin(request: FastifyRequest, reply: FastifyReply, user: ILocalUser, redirect = false) {
public signin(request: FastifyRequest, reply: FastifyReply, user: ILocalUser) {
setImmediate(async () => {
// Append signin history
const record = await this.signinsRepository.insert({
@ -41,25 +41,11 @@ export class SigninService {
this.globalEventService.publishMainStream(user.id, 'signin', await this.signinEntityService.pack(record));
});
if (redirect) {
//#region Cookie
reply.setCookie('igi', user.token!, {
path: '/',
// SEE: https://github.com/koajs/koa/issues/974
// When using a SSL proxy it should be configured to add the "X-Forwarded-Proto: https" header
secure: this.config.url.startsWith('https'),
httpOnly: false,
});
//#endregion
reply.redirect(this.config.url);
} else {
reply.code(200);
return {
id: user.id,
i: user.token,
};
}
reply.code(200);
return {
id: user.id,
i: user.token,
};
}
}

View File

@ -61,8 +61,6 @@ export async function signout() {
} catch (err) {}
//#endregion
document.cookie = 'igi=; path=/';
if (accounts.length > 0) login(accounts[0].token);
else unisonReload('/');
}