diff --git a/backend/src/config/index.ts b/backend/src/config/index.ts index b583156b5..8af6e739a 100644 --- a/backend/src/config/index.ts +++ b/backend/src/config/index.ts @@ -64,22 +64,10 @@ const loginServer = { } const email = { - EMAIL: process.env.EMAIL === 'true', - EMAIL_TEST_MODUS: process.env.EMAIL_TEST_MODUS === 'true', - EMAIL_TEST_RECEIVER: process.env.EMAIL_TEST_RECEIVER ?? 'stage1@gradido.net', - EMAIL_USERNAME: process.env.EMAIL_USERNAME ?? '', - EMAIL_SENDER: process.env.EMAIL_SENDER ?? 'info@gradido.net', - EMAIL_PASSWORD: process.env.EMAIL_PASSWORD ?? '', - EMAIL_SMTP_HOST: process.env.EMAIL_SMTP_HOST ?? 'mailserver', - EMAIL_SMTP_PORT: Number(process.env.EMAIL_SMTP_PORT) || 1025, - - EMAIL_TLS: process.env.EMAIL_TLS !== 'false', EMAIL_LINK_VERIFICATION: COMMUNITY_URL + (process.env.EMAIL_LINK_VERIFICATION_PATH ?? '/checkEmail/'), EMAIL_LINK_SETPASSWORD: COMMUNITY_URL + (process.env.EMAIL_LINK_SETPASSWORD_PATH ?? '/reset-password/'), - EMAIL_LINK_FORGOTPASSWORD: - COMMUNITY_URL + (process.env.EMAIL_LINK_FORGOTPASSWORD_PATH ?? '/forgot-password'), EMAIL_LINK_OVERVIEW: COMMUNITY_URL + (process.env.EMAIL_LINK_OVERVIEW_PATH ?? '/overview'), // time in minutes a optin code is valid EMAIL_CODE_VALID_TIME: process.env.EMAIL_CODE_VALID_TIME diff --git a/backend/src/config/schema.ts b/backend/src/config/schema.ts index f4e6033ea..64871715c 100644 --- a/backend/src/config/schema.ts +++ b/backend/src/config/schema.ts @@ -83,76 +83,6 @@ export const schema = Joi.object({ .default('~/.gradido') .description('The home folder for the gradido dlt node server'), - EMAIL: Joi.boolean() - .default(false) - .description('Enable or disable email functionality') - .required(), - - EMAIL_TEST_MODUS: Joi.boolean() - .default(false) - .description('When enabled, all emails are sended to EMAIL_TEST_RECEIVER') - .optional(), - - EMAIL_TEST_RECEIVER: Joi.string() - .email() - .default('stage1@gradido.net') - .when('EMAIL_TEST_MODUS', { is: true, then: Joi.required() }) - .description('Email address used in test mode'), - - EMAIL_USERNAME: Joi.alternatives().conditional(Joi.ref('EMAIL'), { - is: true, - then: Joi.alternatives().conditional(Joi.ref('NODE_ENV'), { - is: 'development', - then: Joi.string() - .allow('') - .description('Username for SMTP authentication (optional in development)'), - otherwise: Joi.string() - .pattern(/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/) - .description('Valid SMTP username required in production') - .required(), - }), - otherwise: Joi.string().allow('').optional(), - }), - - EMAIL_SENDER: Joi.string() - .email() - .when('EMAIL', { is: true, then: Joi.required() }) - .default('info@gradido.net') - .description('Email address used as sender'), - - EMAIL_PASSWORD: Joi.alternatives().conditional(Joi.ref('EMAIL'), { - is: true, - then: Joi.alternatives().conditional(Joi.ref('NODE_ENV'), { - is: 'development', - then: Joi.string() - .allow('') - .description('Password for SMTP authentication (optional in development)'), - otherwise: Joi.string() - .min(8) - .pattern(/^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[@$!%*?&#]).{8,}$/) - .description( - 'Password must be at least 8 characters long, include uppercase and lowercase letters, a number, and a special character', - ) - .required(), - }), - otherwise: Joi.string().allow('').optional(), - }), - - EMAIL_SMTP_HOST: Joi.string() - .hostname() - .when('EMAIL', { is: true, then: Joi.required() }) - .default('mailserver') - .description('SMTP server hostname'), - - EMAIL_SMTP_PORT: Joi.number() - .integer() - .positive() - .when('EMAIL', { is: true, then: Joi.required() }) - .default(1025) - .description('SMTP server port'), - - EMAIL_TLS: Joi.boolean().default(true).description('Enable or disable TLS for SMTP').optional(), - EMAIL_LINK_VERIFICATION: Joi.string() .uri({ scheme: ['http', 'https'] }) .custom((value: string, helpers: Joi.CustomHelpers): string | Joi.ErrorReport => { @@ -175,17 +105,6 @@ export const schema = Joi.object({ .description('Email Verification link for set initial Password.') .required(), - EMAIL_LINK_FORGOTPASSWORD: Joi.string() - .uri({ scheme: ['http', 'https'] }) - .custom((value: string, helpers: Joi.CustomHelpers): string | Joi.ErrorReport => { - if (!value.startsWith(helpers.state.ancestors[0].COMMUNITY_URL)) { - return helpers.error('string.pattern.base', { value, communityUrl: COMMUNITY_URL }) - } - return value - }) - .description('Email Verification link for set new Password, when old Password was forgotten.') - .required(), - EMAIL_LINK_OVERVIEW: Joi.string() .uri({ scheme: ['http', 'https'] }) .custom((value: string, helpers: Joi.CustomHelpers): string | Joi.ErrorReport => { @@ -213,7 +132,7 @@ export const schema = Joi.object({ .description('Time in minutes before a new code can be requested') .required(), - FEDERATION_VALIDATE_COMMUNITY_TIMER: Joi.number() + FEDERATION_VALIDATE_COMMUNITY_TIMER: Joi.number() .integer() .min(1000) .default(60000)