From 9a9a47503730460b5c01707dbc0f91d3eb7af0d3 Mon Sep 17 00:00:00 2001 From: Shyam Sunder Date: Mon, 22 Jul 2019 19:51:22 -0400 Subject: [PATCH] server/facade: Check mailer config on startup --- server/szurubooru/facade.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/server/szurubooru/facade.py b/server/szurubooru/facade.py index 90709f97..d0306c28 100644 --- a/server/szurubooru/facade.py +++ b/server/szurubooru/facade.py @@ -91,6 +91,20 @@ def validate_config() -> None: if not config.config['database']: raise errors.ConfigError('Database is not configured') + if config.config['smtp']['host']: + if not config.config['smtp']['port']: + raise errors.ConfigError( + 'SMTP host is set but port is not set') + if not config.config['smtp']['user']: + raise errors.ConfigError( + 'SMTP host is set but username is not set') + if not config.config['smtp']['pass']: + raise errors.ConfigError( + 'SMTP host is set but password is not set') + if not config.config['smtp']['from']: + raise errors.ConfigError( + 'From address must be set to use mail-based password reset') + def purge_old_uploads() -> None: while True: