diff --git a/packages/nc-gui/composables/useGlobal/state.ts b/packages/nc-gui/composables/useGlobal/state.ts
index 4fab0a5c72..318dea2a43 100644
--- a/packages/nc-gui/composables/useGlobal/state.ts
+++ b/packages/nc-gui/composables/useGlobal/state.ts
@@ -109,6 +109,7 @@ export function useGlobalState(storageKey = 'nocodb-gui-v2'): State {
automationLogLevel: 'OFF',
disableEmailAuth: false,
dashboardPath: '/dashboard',
+ inviteOnlySignup: false,
})
/** reactive token payload */
diff --git a/packages/nc-gui/composables/useGlobal/types.ts b/packages/nc-gui/composables/useGlobal/types.ts
index f7e640cd7c..9efbfacb45 100644
--- a/packages/nc-gui/composables/useGlobal/types.ts
+++ b/packages/nc-gui/composables/useGlobal/types.ts
@@ -34,6 +34,7 @@ export interface AppInfo {
disableEmailAuth: boolean
mainSubDomain?: string
dashboardPath: string
+ inviteOnlySignup: boolean
}
export interface StoredState {
diff --git a/packages/nc-gui/pages/signin.vue b/packages/nc-gui/pages/signin.vue
index 31cc73eb4e..63d3b35d77 100644
--- a/packages/nc-gui/pages/signin.vue
+++ b/packages/nc-gui/pages/signin.vue
@@ -184,7 +184,7 @@ function navigateForgotPassword() {
-
+
{{ $t('msg.info.signUp.dontHaveAccount') }}
{{ $t('general.signUp') }}
diff --git a/packages/nocodb/src/models/Store.ts b/packages/nocodb/src/models/Store.ts
index a12018fe23..789a87bd41 100644
--- a/packages/nocodb/src/models/Store.ts
+++ b/packages/nocodb/src/models/Store.ts
@@ -2,7 +2,8 @@ import type { SortType } from 'nocodb-sdk';
import { NcError } from '~/helpers/catchError';
import { extractProps } from '~/helpers/extractProps';
import Noco from '~/Noco';
-import { MetaTable } from '~/utils/globals';
+import { CacheGetType, CacheScope, MetaTable } from '~/utils/globals';
+import NocoCache from '~/cache/NocoCache';
// Store is used for storing key value pairs
export default class Store {
@@ -18,8 +19,30 @@ export default class Store {
Object.assign(this, data);
}
- public static get(key: string, ncMeta = Noco.ncMeta): Promise
{
- return ncMeta.metaGet(null, null, MetaTable.STORE, { key });
+ public static async get(
+ key: string,
+ lookInCache = false,
+ ncMeta = Noco.ncMeta,
+ ): Promise {
+ // get from cache if lookInCache is true
+ if (lookInCache) {
+ const storeData =
+ key &&
+ (await NocoCache.get(
+ `${CacheScope.STORE}:${key}`,
+ CacheGetType.TYPE_OBJECT,
+ ));
+ if (storeData) return storeData;
+ }
+
+ const storeData = await ncMeta.metaGet(null, null, MetaTable.STORE, {
+ key,
+ });
+
+ if (lookInCache)
+ await NocoCache.set(`${CacheScope.STORE}:${key}`, storeData);
+
+ return storeData;
}
static async saveOrUpdate(store: Store, ncMeta = Noco.ncMeta) {
@@ -35,7 +58,7 @@ export default class Store {
'tag',
]);
- const existing = await Store.get(store.key, ncMeta);
+ const existing = await Store.get(store.key,false, ncMeta);
if (existing) {
await ncMeta.metaUpdate(null, null, MetaTable.STORE, insertObj, {
key: store.key,
@@ -43,5 +66,6 @@ export default class Store {
} else {
await ncMeta.metaInsert(null, null, MetaTable.STORE, insertObj);
}
+ if (store.key) await NocoCache.del(`${CacheScope.STORE}:${store.key}`);
}
}
diff --git a/packages/nocodb/src/services/utils.service.ts b/packages/nocodb/src/services/utils.service.ts
index 9cd676aef3..2786ca4783 100644
--- a/packages/nocodb/src/services/utils.service.ts
+++ b/packages/nocodb/src/services/utils.service.ts
@@ -5,10 +5,10 @@ import { ViewTypes } from 'nocodb-sdk';
import { ConfigService } from '@nestjs/config';
import { useAgent } from 'request-filtering-agent';
import type { AppConfig } from '~/interface/config';
-import { NC_ATTACHMENT_FIELD_SIZE } from '~/constants';
+import { NC_APP_SETTINGS, NC_ATTACHMENT_FIELD_SIZE } from '~/constants';
import SqlMgrv2 from '~/db/sql-mgr/v2/SqlMgrv2';
import { NcError } from '~/helpers/catchError';
-import { Base, User } from '~/models';
+import { Base, Store, User } from '~/models';
import Noco from '~/Noco';
import NcConnectionMgrv2 from '~/utils/common/NcConnectionMgrv2';
import { MetaTable } from '~/utils/globals';
@@ -365,6 +365,12 @@ export class UtilsService {
async appInfo(param: { req: { ncSiteUrl: string } }) {
const baseHasAdmin = !(await User.isFirst());
+
+ let settings: { invite_only_signup?: boolean } = {};
+ try {
+ settings = JSON.parse((await Store.get(NC_APP_SETTINGS, true))?.value);
+ } catch {}
+
const oidcAuthEnabled = !!(
process.env.NC_OIDC_ISSUER &&
process.env.NC_OIDC_AUTHORIZATION_URL &&
@@ -415,6 +421,7 @@ export class UtilsService {
}),
mainSubDomain: this.configService.get('mainSubDomain', { infer: true }),
dashboardPath: this.configService.get('dashboardPath', { infer: true }),
+ inviteOnlySignup: settings.invite_only_signup,
};
return result;
diff --git a/packages/nocodb/src/utils/globals.ts b/packages/nocodb/src/utils/globals.ts
index 0a31046558..07e7096526 100644
--- a/packages/nocodb/src/utils/globals.ts
+++ b/packages/nocodb/src/utils/globals.ts
@@ -158,6 +158,7 @@ export enum CacheScope {
SINGLE_QUERY = 'singleQuery',
JOBS = 'nc_jobs',
PRESIGNED_URL = 'presignedUrl',
+ STORE = 'presignedUrl',
}
export enum CacheGetType {