From f5b669c386ad6496eab5e55f9477e61096da3348 Mon Sep 17 00:00:00 2001 From: Antonio Cheong Date: Sun, 10 Nov 2024 00:50:46 +0000 Subject: [PATCH] use DEFAULT_LOGIN_METHOD instead for more flexibility. defaults to otp. --- desktop/src/ui/platform.ts | 2 +- desktop/src/ui/types.ts | 2 +- dev/prod/src/platform.ts | 2 +- plugins/login-resources/src/components/LoginForm.svelte | 4 ++-- plugins/login/src/index.ts | 2 +- server/front/src/starter.ts | 4 ++-- 6 files changed, 8 insertions(+), 8 deletions(-) diff --git a/desktop/src/ui/platform.ts b/desktop/src/ui/platform.ts index 0e9f53cbc61..5e3ef04cde5 100644 --- a/desktop/src/ui/platform.ts +++ b/desktop/src/ui/platform.ts @@ -202,7 +202,7 @@ export async function configurePlatform(): Promise { 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) diff --git a/desktop/src/ui/types.ts b/desktop/src/ui/types.ts index 5931eccdc29..69435886bda 100644 --- a/desktop/src/ui/types.ts +++ b/desktop/src/ui/types.ts @@ -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 diff --git a/dev/prod/src/platform.ts b/dev/prod/src/platform.ts index a5ac58c7e88..42597b20528 100644 --- a/dev/prod/src/platform.ts +++ b/dev/prod/src/platform.ts @@ -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) diff --git a/plugins/login-resources/src/components/LoginForm.svelte b/plugins/login-resources/src/components/LoginForm.svelte index 16f619ddb53..1445b7c55cd 100644 --- a/plugins/login-resources/src/components/LoginForm.svelte +++ b/plugins/login-resources/src/components/LoginForm.svelte @@ -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 } diff --git a/plugins/login/src/index.ts b/plugins/login/src/index.ts index acc09131ada..068e4f470df 100644 --- a/plugins/login/src/index.ts +++ b/plugins/login/src/index.ts @@ -73,7 +73,7 @@ export default plugin(loginId, { LastToken: '' as Metadata, LoginEndpoint: '' as Metadata, LoginEmail: '' as Metadata, - LoginPasswordOnly: '' as Metadata, + DefaultLoginMethod: '' as Metadata, DisableSignUp: '' as Metadata }, component: { diff --git a/server/front/src/starter.ts b/server/front/src/starter.ts index 81abbbec963..f732275c44c 100644 --- a/server/front/src/starter.ts +++ b/server/front/src/starter.ts @@ -119,7 +119,7 @@ export function startFront (ctx: MeasureContext, extraConfig?: Record