mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-07-20 19:46:32 +08:00
fix: web login (#14378)
#### PR Dependency Tree * **PR #14378** 👈 This tree was auto-generated by [Charcoal](https://github.com/danerwilliams/charcoal) <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Added a deprecated GET sign-out endpoint for backward compatibility with legacy clients. * **Improvements** * Updated magic-link and OAuth flows to always generate and manage client nonces; native clients use a nonce, web preserves cross-device behavior. * **Tests** * Added tests covering the deprecated sign-out flow and OAuth preflight client_nonce handling. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
@@ -228,6 +228,30 @@ export class AuthController {
|
||||
});
|
||||
}
|
||||
|
||||
@Public()
|
||||
/**
|
||||
* @deprecated Kept for 0.25 clients that still call GET `/api/auth/sign-out`.
|
||||
* Use POST `/api/auth/sign-out` instead.
|
||||
*/
|
||||
@Get('/sign-out')
|
||||
async signOutDeprecated(
|
||||
@Res() res: Response,
|
||||
@Session() session: Session | undefined,
|
||||
@Query('user_id') userId: string | undefined
|
||||
) {
|
||||
res.setHeader('Deprecation', 'true');
|
||||
|
||||
if (!session) {
|
||||
res.status(HttpStatus.OK).send({});
|
||||
return;
|
||||
}
|
||||
|
||||
await this.auth.signOut(session.sessionId, userId);
|
||||
await this.auth.refreshCookies(res, session.sessionId);
|
||||
|
||||
res.status(HttpStatus.OK).send({});
|
||||
}
|
||||
|
||||
@Public()
|
||||
@Post('/sign-out')
|
||||
async signOut(
|
||||
|
||||
Reference in New Issue
Block a user