mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-20 03:12:15 +00:00
feat(core): Invalidate all sessions when MFA is enabled/disabled (#15524)
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
import type { User } from '@n8n/db';
|
||||
import { AuthUserRepository } from '@n8n/db';
|
||||
import { UserRepository, type User } from '@n8n/db';
|
||||
import { Container } from '@n8n/di';
|
||||
import { randomString } from 'n8n-workflow';
|
||||
|
||||
@@ -130,7 +129,7 @@ describe('Enable MFA setup', () => {
|
||||
await testServer.authAgentFor(owner).post('/mfa/verify').send({ mfaCode }).expect(200);
|
||||
await testServer.authAgentFor(owner).post('/mfa/enable').send({ mfaCode }).expect(200);
|
||||
|
||||
const user = await Container.get(AuthUserRepository).findOneOrFail({
|
||||
const user = await Container.get(UserRepository).findOneOrFail({
|
||||
where: {},
|
||||
});
|
||||
|
||||
@@ -153,7 +152,7 @@ describe('Enable MFA setup', () => {
|
||||
|
||||
await testServer.authAgentFor(owner).post('/mfa/enable').send({ mfaCode }).expect(400);
|
||||
|
||||
const user = await Container.get(AuthUserRepository).findOneOrFail({
|
||||
const user = await Container.get(UserRepository).findOneOrFail({
|
||||
where: {},
|
||||
});
|
||||
|
||||
@@ -175,7 +174,7 @@ describe('Disable MFA setup', () => {
|
||||
})
|
||||
.expect(200);
|
||||
|
||||
const dbUser = await Container.get(AuthUserRepository).findOneOrFail({
|
||||
const dbUser = await Container.get(UserRepository).findOneOrFail({
|
||||
where: { id: user.id },
|
||||
});
|
||||
|
||||
@@ -396,7 +395,7 @@ describe('Login', () => {
|
||||
const data = response.body.data;
|
||||
expect(data.mfaEnabled).toBe(true);
|
||||
|
||||
const dbUser = await Container.get(AuthUserRepository).findOneOrFail({
|
||||
const dbUser = await Container.get(UserRepository).findOneOrFail({
|
||||
where: { id: user.id },
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user