From cdf54fd19c4c87425317447dafc4c03bc2c2e8d9 Mon Sep 17 00:00:00 2001 From: Eldad Fux Date: Tue, 23 Feb 2021 14:00:31 +0200 Subject: [PATCH] Disable recovery when SMTP is off --- .env | 2 +- app/controllers/web/home.php | 4 ++++ app/views/home/auth/recovery.phtml | 11 ++++++++++- app/views/home/auth/signup.phtml | 4 ++++ 4 files changed, 19 insertions(+), 2 deletions(-) diff --git a/.env b/.env index eb1c594ed..927a863f2 100644 --- a/.env +++ b/.env @@ -26,7 +26,7 @@ _APP_INFLUXDB_HOST=influxdb _APP_INFLUXDB_PORT=8086 _APP_STATSD_HOST=telegraf _APP_STATSD_PORT=8125 -_APP_SMTP_HOST=maildev +_APP_SMTP_HOST= _APP_SMTP_PORT=25 _APP_SMTP_SECURE= _APP_SMTP_USERNAME= diff --git a/app/controllers/web/home.php b/app/controllers/web/home.php index 18231e4a0..0a26c67a8 100644 --- a/app/controllers/web/home.php +++ b/app/controllers/web/home.php @@ -123,6 +123,10 @@ App::get('/auth/recovery') $page = new View(__DIR__.'/../../views/home/auth/recovery.phtml'); + $page + ->setParam('smtpEnabled', (!empty(App::getEnv('_APP_SMTP_HOST')))) + ; + $layout ->setParam('title', 'Password Recovery - '.APP_NAME) ->setParam('body', $page); diff --git a/app/views/home/auth/recovery.phtml b/app/views/home/auth/recovery.phtml index 6f633b9a0..39ac4237f 100644 --- a/app/views/home/auth/recovery.phtml +++ b/app/views/home/auth/recovery.phtml @@ -1,3 +1,6 @@ +getParam('smtpEnabled', false); +?>

Password Recovery @@ -25,7 +28,13 @@ - + +
+ SMTP connection is disabled. Learn more +
+ + +

diff --git a/app/views/home/auth/signup.phtml b/app/views/home/auth/signup.phtml index 03613746e..6b5d01f7e 100644 --- a/app/views/home/auth/signup.phtml +++ b/app/views/home/auth/signup.phtml @@ -26,6 +26,10 @@ $god = ($this->getParam('god') !== 'disabled'); data-failure-param-alert-text="Registration Failed. Please try again later" data-failure-param-alert-classname="error"> + +

Please create your first god account

+ +