Skip to content

Commit

Permalink
Merge pull request #1098 from jetstreamapp/chore/allow-default-email-…
Browse files Browse the repository at this point in the history
…mfa-value

Add env var for default email mfa for new users
  • Loading branch information
paustint authored Nov 28, 2024
2 parents 49d73b2 + cfefe8a commit 189a635
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
2 changes: 2 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ NX_SFDC_API_VERSION='62.0'
# trace, debug (default), info, warn, error, fatal, silent
LOG_LEVEL='trace'

# Default value for email two-factor authentication for new users
JETSTREAM_AUTH_2FA_EMAIL_DEFAULT_VALUE='false'
# Session signing secret - minimum of 32 characters
# Generate using: `openssl rand -base64 32`
JETSTREAM_SESSION_SECRET=''
Expand Down
1 change: 1 addition & 0 deletions libs/api-config/src/lib/env-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ const envSchema = z.object({
AUTH0_DOMAIN: z.string().nullish(),

// JETSTREAM
JETSTREAM_AUTH_2FA_EMAIL_DEFAULT_VALUE: z.union([z.string(), z.boolean()]).optional().default(true).transform(ensureBoolean),
JETSTREAM_AUTH_SECRET: z.string().describe('Used to sign authentication cookies.'),
// Must be 32 characters
JETSTREAM_AUTH_OTP_SECRET: z.string(),
Expand Down
4 changes: 2 additions & 2 deletions libs/auth/server/src/lib/auth.db.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -627,7 +627,7 @@ async function createUserFromProvider(providerUser: ProviderUser, provider: Oaut
authFactors: {
create: {
type: '2fa-email',
enabled: true,
enabled: ENV.JETSTREAM_AUTH_2FA_EMAIL_DEFAULT_VALUE,
},
},
},
Expand Down Expand Up @@ -740,7 +740,7 @@ async function createUserFromUserInfo(email: string, name: string, password: str
authFactors: {
create: {
type: '2fa-email',
enabled: true,
enabled: ENV.JETSTREAM_AUTH_2FA_EMAIL_DEFAULT_VALUE,
},
},
},
Expand Down

0 comments on commit 189a635

Please sign in to comment.