Skip to content

Commit

Permalink
Update migration script
Browse files Browse the repository at this point in the history
Only force 2fa for migrated users that have a password set up
  • Loading branch information
paustint committed Nov 5, 2024
1 parent d6e32b3 commit 437f405
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions scripts/auth-migration/auth-migration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -240,13 +240,15 @@ async function updateUsersInJetstreamDatabase(users: Auth0User[]) {
const jetstreamAuthFactors: Prisma.AuthFactorsCreateWithoutUserInput[] = [];
const jetstreamAuthIdentity: Prisma.AuthIdentityCreateWithoutUserInput[] = [];

jetstreamAuthFactors.push({
enabled: true, // Users can choose "remember this device" or disable in settings
secret: null,
type: '2fa-email',
createdAt: new Date(),
updatedAt: new Date(),
});
if (jetstreamUser.password) {
jetstreamAuthFactors.push({
enabled: true, // Users can choose "remember this device" or disable in settings
secret: null,
type: '2fa-email',
createdAt: new Date(),
updatedAt: new Date(),
});
}

let identities = user.identities;
let isFirstItemPrimary = true;
Expand Down

0 comments on commit 437f405

Please sign in to comment.