mirror of
https://github.com/nocobase/nocobase.git
synced 2026-08-28 17:43:07 +08:00
Merge branch 'main' into next
This commit is contained in:
@@ -84,6 +84,14 @@ export class TokenController implements TokenControlService {
|
||||
});
|
||||
}
|
||||
|
||||
private async cleanupSessionExpiredTokens(userId: number) {
|
||||
try {
|
||||
await this.removeSessionExpiredTokens(userId);
|
||||
} catch (err) {
|
||||
this.logger.error(err, { module: 'auth', submodule: 'token-controller', method: 'removeSessionExpiredTokens' });
|
||||
}
|
||||
}
|
||||
|
||||
async add({ userId, authenticator }: { userId: number; authenticator?: string }) {
|
||||
const jti = randomUUID();
|
||||
const currTS = Date.now();
|
||||
@@ -97,15 +105,11 @@ export class TokenController implements TokenControlService {
|
||||
};
|
||||
await this.setTokenInfo(jti, data);
|
||||
|
||||
try {
|
||||
if (process.env.DB_DIALECT === 'sqlite') {
|
||||
// SQLITE does not support concurrent operations
|
||||
await this.removeSessionExpiredTokens(userId);
|
||||
} else {
|
||||
this.removeSessionExpiredTokens(userId);
|
||||
}
|
||||
} catch (err) {
|
||||
this.logger.error(err, { module: 'auth', submodule: 'token-controller', method: 'removeSessionExpiredTokens' });
|
||||
if (process.env.DB_DIALECT === 'sqlite') {
|
||||
// SQLITE does not support concurrent operations
|
||||
await this.cleanupSessionExpiredTokens(userId);
|
||||
} else {
|
||||
this.cleanupSessionExpiredTokens(userId);
|
||||
}
|
||||
|
||||
return data;
|
||||
|
||||
Reference in New Issue
Block a user