Skip to content

Commit

Permalink
use DEFAULT_LOGIN_METHOD instead for more flexibility. defaults to otp.
Browse files Browse the repository at this point in the history
  • Loading branch information
acheong08 committed Nov 10, 2024
1 parent b661127 commit f5b669c
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion desktop/src/ui/platform.ts
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ export async function configurePlatform(): Promise<void> {

setMetadata(login.metadata.AccountsUrl, config.ACCOUNTS_URL)
setMetadata(login.metadata.DisableSignUp, config.DISABLE_SIGNUP === 'true')
setMetadata(login.metadata.LoginPasswordOnly, config.LOGIN_PASSWORD_ONLY === 'true')
setMetadata(login.metadata.DefaultLoginMethod, config.DEFAULT_LOGIN_METHOD)
setMetadata(presentation.metadata.UploadURL, config.UPLOAD_URL)
setMetadata(presentation.metadata.FilesURL, config.FILES_URL)
setMetadata(presentation.metadata.CollaboratorUrl, config.COLLABORATOR_URL)
Expand Down
2 changes: 1 addition & 1 deletion desktop/src/ui/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export interface Config {
ANALYTICS_COLLECTOR_URL?: string
AI_URL?: string
DISABLE_SIGNUP?: string
LOGIN_PASSWORD_ONLY?: string
DEFAULT_LOGIN_METHOD?: string
BRANDING_URL?: string
PREVIEW_CONFIG: string
UPLOAD_CONFIG: string
Expand Down
2 changes: 1 addition & 1 deletion dev/prod/src/platform.ts
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ export async function configurePlatform() {

setMetadata(login.metadata.AccountsUrl, config.ACCOUNTS_URL)
setMetadata(login.metadata.DisableSignUp, config.DISABLE_SIGNUP === 'true')
setMetadata(login.metadata.LoginPasswordOnly, config.LOGIN_PASSWORD_ONLY === 'true')
setMetadata(login.metadata.DefaultLoginMethod, config.DEFAULT_LOGIN_METHOD)
setMetadata(presentation.metadata.FilesURL, config.FILES_URL)
setMetadata(presentation.metadata.UploadURL, config.UPLOAD_URL)
setMetadata(presentation.metadata.CollaboratorUrl, config.COLLABORATOR_URL)
Expand Down
4 changes: 2 additions & 2 deletions plugins/login-resources/src/components/LoginForm.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@
export let navigateUrl: string | undefined = undefined
export let signUpDisabled = false
const loginPasswordOnly = getMetadata(login.metadata.LoginPasswordOnly) ?? false
const defaultLoginMethod = getMetadata(login.metadata.DefaultLoginMethod) ?? 'otp'
let method: LoginMethods = LoginMethods.Otp
if (loginPasswordOnly === true) {
if (defaultLoginMethod === 'password') {
method = LoginMethods.Password
}
Expand Down
2 changes: 1 addition & 1 deletion plugins/login/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ export default plugin(loginId, {
LastToken: '' as Metadata<string>,
LoginEndpoint: '' as Metadata<string>,
LoginEmail: '' as Metadata<string>,
LoginPasswordOnly: '' as Metadata<boolean>,
DefaultLoginMethod: '' as Metadata<string>,
DisableSignUp: '' as Metadata<boolean>
},
component: {
Expand Down
4 changes: 2 additions & 2 deletions server/front/src/starter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ export function startFront (ctx: MeasureContext, extraConfig?: Record<string, st

const disableSignUp = process.env.DISABLE_SIGNUP

const loginPasswordOnly = process.env.LOGIN_PASSWORD_ONLY
const defaultLoginMethod = process.env.DEFAULT_LOGIN_METHOD

const config = {
elasticUrl,
Expand All @@ -140,7 +140,7 @@ export function startFront (ctx: MeasureContext, extraConfig?: Record<string, st
uploadConfig,
pushPublicKey,
disableSignUp,
loginPasswordOnly
defaultLoginMethod
}
console.log('Starting Front service with', config)
const shutdown = start(ctx, config, SERVER_PORT, extraConfig)
Expand Down

0 comments on commit f5b669c

Please sign in to comment.