Aktueller Stand
This commit is contained in:
@@ -8,9 +8,11 @@ export type SystemSettings = AccessSettings & {
|
||||
apiKey: string;
|
||||
provider: "google" | "osm";
|
||||
registrationEnabled: boolean;
|
||||
emailVerificationRequired: boolean;
|
||||
};
|
||||
|
||||
const PUBLIC_ACCESS_KEY = "public_access_enabled";
|
||||
const EMAIL_VERIFICATION_KEY = "email_verification_required";
|
||||
const LEGACY_ACCESS_KEYS = [
|
||||
"public_events_enabled",
|
||||
"anonymous_access_enabled"
|
||||
@@ -18,7 +20,8 @@ const LEGACY_ACCESS_KEYS = [
|
||||
const SYSTEM_KEYS = [
|
||||
"google_places_api_key",
|
||||
"geocoding_provider",
|
||||
"registration_enabled"
|
||||
"registration_enabled",
|
||||
EMAIL_VERIFICATION_KEY
|
||||
] as const;
|
||||
|
||||
const getSettingMap = async (keys: readonly string[]) => {
|
||||
@@ -96,12 +99,24 @@ export async function getSystemSettings(): Promise<SystemSettings> {
|
||||
settings.get("registration_enabled"),
|
||||
true
|
||||
);
|
||||
const emailVerificationRequired = readBoolean(
|
||||
settings.get(EMAIL_VERIFICATION_KEY),
|
||||
true
|
||||
);
|
||||
const publicAccessEnabled = await ensurePublicAccessSetting(settings);
|
||||
|
||||
return {
|
||||
apiKey,
|
||||
provider,
|
||||
registrationEnabled,
|
||||
publicAccessEnabled
|
||||
publicAccessEnabled,
|
||||
emailVerificationRequired
|
||||
};
|
||||
}
|
||||
|
||||
export async function getEmailVerificationRequired(): Promise<boolean> {
|
||||
const setting = await prisma.setting.findUnique({
|
||||
where: { key: EMAIL_VERIFICATION_KEY }
|
||||
});
|
||||
return setting?.value !== "false";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user