fix(identity): add security stamp and invalidate user cache on token handling

This commit is contained in:
shuaiplus
2026-07-02 16:57:24 +08:00
parent 1545881eae
commit 439683d350
+2
View File
@@ -419,9 +419,11 @@ export async function handleToken(request: Request, env: Env): Promise<Response>
}
user.totpSecret = null;
user.totpRecoveryCode = createRecoveryCode();
user.securityStamp = generateUUID();
user.updatedAt = new Date().toISOString();
await storage.saveUser(user);
await storage.deleteRefreshTokensByUserId(user.id);
AuthService.invalidateUserCache(user.id);
rememberRequested = false;
} else {
// Unsupported provider for this server profile behaves as an invalid 2FA attempt.