mirror of
https://gitee.com/nocobase/nocobase.git
synced 2025-07-01 10:42:19 +08:00
fix: handle expired session error in auth flow and remove unused cache update
This commit is contained in:
parent
2137af619d
commit
e2b7c5109e
@ -173,6 +173,13 @@ export class BaseAuth extends Auth {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!jti) {
|
||||||
|
this.ctx.throw(401, {
|
||||||
|
message: this.ctx.t('Your session has expired. Please sign in again.', { ns: localeNamespace }),
|
||||||
|
code: AuthErrorCode.INVALID_TOKEN,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
const renewedResult = await this.tokenController.renew(jti);
|
const renewedResult = await this.tokenController.renew(jti);
|
||||||
this.ctx.logger.info('token renewed', {
|
this.ctx.logger.info('token renewed', {
|
||||||
method: 'auth.check',
|
method: 'auth.check',
|
||||||
|
@ -41,7 +41,6 @@ export class TokenController implements TokenControlService {
|
|||||||
async setTokenInfo(id: string, value: TokenInfo): Promise<void> {
|
async setTokenInfo(id: string, value: TokenInfo): Promise<void> {
|
||||||
const repo = this.app.db.getRepository<Repository<TokenInfo>>(issuedTokensCollectionName);
|
const repo = this.app.db.getRepository<Repository<TokenInfo>>(issuedTokensCollectionName);
|
||||||
await repo.updateOrCreate({ filterKeys: ['id'], values: value });
|
await repo.updateOrCreate({ filterKeys: ['id'], values: value });
|
||||||
await this.cache.set(`${JTICACHEKEY}:${id}`, value);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user