mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-19 19:11:13 +00:00
refactor(core): Extract all Auth-related User columns into a separate entity (#9557)
Co-authored-by: Ricardo Espinoza <ricardo@n8n.io>
This commit is contained in:
committed by
GitHub
parent
08902bf941
commit
5887ed6498
@@ -742,7 +742,6 @@ export interface CurrentUserResponse extends IUserResponse {
|
||||
export interface IUser extends IUserResponse {
|
||||
isDefaultUser: boolean;
|
||||
isPendingUser: boolean;
|
||||
hasRecoveryCodesLeft: boolean;
|
||||
inviteAcceptUrl?: string;
|
||||
fullName?: string;
|
||||
createdAt?: string;
|
||||
|
||||
@@ -10,7 +10,6 @@ export const createUser = (overrides?: Partial<IUser>): IUser => ({
|
||||
isDefaultUser: false,
|
||||
isPending: false,
|
||||
isPendingUser: false,
|
||||
hasRecoveryCodesLeft: false,
|
||||
mfaEnabled: false,
|
||||
signInType: SignInType.EMAIL,
|
||||
...overrides,
|
||||
|
||||
@@ -28,7 +28,4 @@ export const userFactory = Factory.extend<IUser>({
|
||||
mfaEnabled() {
|
||||
return false;
|
||||
},
|
||||
hasRecoveryCodesLeft() {
|
||||
return false;
|
||||
},
|
||||
});
|
||||
|
||||
@@ -30,7 +30,6 @@ const pinia = createTestingPinia({
|
||||
lastName: 'Doe',
|
||||
isDefaultUser: false,
|
||||
isPendingUser: false,
|
||||
hasRecoveryCodesLeft: true,
|
||||
role: ROLE.Owner,
|
||||
mfaEnabled: false,
|
||||
},
|
||||
|
||||
@@ -148,7 +148,11 @@ export default defineComponent({
|
||||
this.verifyingMfaToken = true;
|
||||
this.hasAnyChanges = true;
|
||||
|
||||
this.onSubmit({ token: value, recoveryCode: value })
|
||||
const dataToSubmit = isSubmittingMfaToken
|
||||
? { token: value, recoveryCode: '' }
|
||||
: { token: '', recoveryCode: value };
|
||||
|
||||
this.onSubmit(dataToSubmit)
|
||||
.catch(() => {})
|
||||
.finally(() => (this.verifyingMfaToken = false));
|
||||
},
|
||||
|
||||
@@ -144,7 +144,6 @@ export default defineComponent({
|
||||
}
|
||||
await this.settingsStore.getSettings();
|
||||
this.clearAllStickyNotifications();
|
||||
this.checkRecoveryCodesLeft();
|
||||
|
||||
this.$telemetry.track('User attempted to login', {
|
||||
result: this.showMfaView ? 'mfa_success' : 'success',
|
||||
@@ -198,21 +197,6 @@ export default defineComponent({
|
||||
this.email = form.email;
|
||||
this.password = form.password;
|
||||
},
|
||||
checkRecoveryCodesLeft() {
|
||||
if (this.usersStore.currentUser) {
|
||||
const { hasRecoveryCodesLeft, mfaEnabled } = this.usersStore.currentUser;
|
||||
|
||||
if (mfaEnabled && !hasRecoveryCodesLeft) {
|
||||
this.showToast({
|
||||
title: this.$locale.baseText('settings.mfa.toast.noRecoveryCodeLeft.title'),
|
||||
message: this.$locale.baseText('settings.mfa.toast.noRecoveryCodeLeft.message'),
|
||||
type: 'info',
|
||||
duration: 0,
|
||||
dangerouslyUseHTMLString: true,
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
});
|
||||
</script>
|
||||
|
||||
@@ -24,7 +24,6 @@ const currentUser = {
|
||||
isDefaultUser: false,
|
||||
isPendingUser: false,
|
||||
isPending: false,
|
||||
hasRecoveryCodesLeft: false,
|
||||
mfaEnabled: false,
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user