File tree Expand file tree Collapse file tree 3 files changed +27
-22
lines changed
features/instance/operations/mutations Expand file tree Collapse file tree 3 files changed +27
-22
lines changed Original file line number Diff line number Diff line change 1+ export const forceBasicAuth = import . meta. env . VITE_FORCE_BASIC_AUTH === 'true' ;
12export const isLocalStudio = import . meta. env . VITE_LOCAL_STUDIO === 'true' ;
23export const localStudioDevUrl = import . meta. env . VITE_LOCAL_STUDIO_DEV_URL ;
34export const defaultOperationsApiPort = 9925 ;
Original file line number Diff line number Diff line change 1+ import { forceBasicAuth } from '@/config/constants' ;
12import { InstanceClientIdConfig } from '@/config/instanceClientConfig' ;
23import { authStore } from '@/features/auth/store/authStore' ;
34import { getInstanceUserInfo } from '@/features/instance/operations/queries/getInstanceUserInfo' ;
@@ -26,29 +27,31 @@ export async function onInstanceLoginSubmit({
2627 password,
2728 } ) ;
2829
29- // Attempt to use the login with session storage only.
30- try {
31- const user = await getInstanceUserInfo ( { instanceClient } ) ;
32- return {
33- message,
34- user,
35- } ;
36- } catch ( err ) {
37- console . error ( 'Failed to get user after login, trying basic auth' , err ) ;
38-
39- const user = await getInstanceUserInfo ( {
40- instanceClient,
41- auth : {
42- username,
43- password,
44- } ,
45- } ) ;
46- authStore . flagForBasicAuth ( entityId , { username, password } ) ;
47- return {
48- message,
49- user,
50- } ;
30+ if ( ! forceBasicAuth ) {
31+ // Attempt to use the login with session storage only.
32+ try {
33+ const user = await getInstanceUserInfo ( { instanceClient } ) ;
34+ return {
35+ message,
36+ user,
37+ } ;
38+ } catch ( err ) {
39+ console . error ( 'Failed to get user after login, trying basic auth' , err ) ;
40+ }
5141 }
42+
43+ const user = await getInstanceUserInfo ( {
44+ instanceClient,
45+ auth : {
46+ username,
47+ password,
48+ } ,
49+ } ) ;
50+ authStore . flagForBasicAuth ( entityId , { username, password } ) ;
51+ return {
52+ message,
53+ user,
54+ } ;
5255}
5356
5457export function useInstanceLoginMutation ( ) {
Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ interface ImportMetaEnv {
44 readonly DEV : string ;
55 readonly VITE_STUDIO_VERSION : string ;
66 readonly VITE_LOCAL_STUDIO : string ; //INFO: This flag is the local version of studio ran on HarperDb instances
7+ readonly VITE_FORCE_BASIC_AUTH : string ;
78 readonly VITE_ENV_NAME : string ;
89 readonly VITE_PUBLIC_STRIPE_KEY : string ;
910 readonly VITE_LOCAL_STUDIO_DEV_URL : string ;
You can’t perform that action at this time.
0 commit comments