summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrederic Guillot <fred@kanboard.net>2017-02-05 11:54:27 -0500
committerFrederic Guillot <fred@kanboard.net>2017-02-05 11:54:27 -0500
commitd0a1ed9227a5166aa56d37ccea142cdb1e0ae082 (patch)
treeccdf94fcd4befcf167a4f7b6fd62d0cb7f3bc5b4
parenta2e2ab8997cc57042aadbd507109acdbe0475c2d (diff)
Add configuration parameter to disable email configuration from user interface
-rw-r--r--ChangeLog1
-rw-r--r--app/Helper/MailHelper.php18
-rw-r--r--app/Locale/bs_BA/translations.php1
-rw-r--r--app/Locale/cs_CZ/translations.php1
-rw-r--r--app/Locale/da_DK/translations.php1
-rw-r--r--app/Locale/de_DE/translations.php1
-rw-r--r--app/Locale/el_GR/translations.php1
-rw-r--r--app/Locale/es_ES/translations.php1
-rw-r--r--app/Locale/fi_FI/translations.php1
-rw-r--r--app/Locale/fr_FR/translations.php1
-rw-r--r--app/Locale/hu_HU/translations.php1
-rw-r--r--app/Locale/id_ID/translations.php1
-rw-r--r--app/Locale/it_IT/translations.php1
-rw-r--r--app/Locale/ja_JP/translations.php1
-rw-r--r--app/Locale/ko_KR/translations.php1
-rw-r--r--app/Locale/my_MY/translations.php1
-rw-r--r--app/Locale/nb_NO/translations.php1
-rw-r--r--app/Locale/nl_NL/translations.php1
-rw-r--r--app/Locale/pl_PL/translations.php1
-rw-r--r--app/Locale/pt_BR/translations.php1
-rw-r--r--app/Locale/pt_PT/translations.php1
-rw-r--r--app/Locale/ru_RU/translations.php1
-rw-r--r--app/Locale/sr_Latn_RS/translations.php1
-rw-r--r--app/Locale/sv_SE/translations.php1
-rw-r--r--app/Locale/th_TH/translations.php1
-rw-r--r--app/Locale/tr_TR/translations.php1
-rw-r--r--app/Locale/zh_CN/translations.php1
-rw-r--r--app/Template/config/email.php12
-rw-r--r--app/constants.php1
-rw-r--r--config.default.php5
-rw-r--r--doc/en_US/config.markdown5
-rw-r--r--doc/tr_TR/config.markdown5
32 files changed, 58 insertions, 14 deletions
diff --git a/ChangeLog b/ChangeLog
index 9b36d5f9..44dd12a7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -3,6 +3,7 @@ Version 1.0.39 (unreleased)
Improvements:
+* Add configuration parameter to disable email configuration from user interface
* Add email address field for projects
* Improve forget password behaviour (notify the user that an email has been sent or not)
* Do not display current project in board selector
diff --git a/app/Helper/MailHelper.php b/app/Helper/MailHelper.php
index 3b1c9e41..b42d83ab 100644
--- a/app/Helper/MailHelper.php
+++ b/app/Helper/MailHelper.php
@@ -54,27 +54,31 @@ class MailHelper extends Base
*/
public function getMailSenderAddress()
{
- $email = $this->configModel->get('mail_sender_address');
+ if (MAIL_CONFIGURATION) {
+ $email = $this->configModel->get('mail_sender_address');
- if (!empty($email)) {
- return $email;
+ if (! empty($email)) {
+ return $email;
+ }
}
return MAIL_FROM;
}
/**
- * Get mail sender address
+ * Get mail transport
*
* @access public
* @return string
*/
public function getMailTransport()
{
- $transport = $this->configModel->get('mail_transport');
+ if (MAIL_CONFIGURATION) {
+ $transport = $this->configModel->get('mail_transport');
- if (!empty($transport)) {
- return $transport;
+ if (! empty($transport)) {
+ return $transport;
+ }
}
return MAIL_TRANSPORT;
diff --git a/app/Locale/bs_BA/translations.php b/app/Locale/bs_BA/translations.php
index 9dfe2a3e..a168f6df 100644
--- a/app/Locale/bs_BA/translations.php
+++ b/app/Locale/bs_BA/translations.php
@@ -1313,4 +1313,5 @@ return array(
// 'TRL - Turkish Lira' => '',
// 'The project email is optional and could be used by several plugins.' => '',
// 'The email project must be unique across all projects' => '',
+ // 'The email configuration has been disabled by the administrator.' => '',
);
diff --git a/app/Locale/cs_CZ/translations.php b/app/Locale/cs_CZ/translations.php
index 8ab5aa7f..96b50af3 100644
--- a/app/Locale/cs_CZ/translations.php
+++ b/app/Locale/cs_CZ/translations.php
@@ -1313,4 +1313,5 @@ return array(
// 'TRL - Turkish Lira' => '',
// 'The project email is optional and could be used by several plugins.' => '',
// 'The email project must be unique across all projects' => '',
+ // 'The email configuration has been disabled by the administrator.' => '',
);
diff --git a/app/Locale/da_DK/translations.php b/app/Locale/da_DK/translations.php
index eeb02e1d..5d61581c 100644
--- a/app/Locale/da_DK/translations.php
+++ b/app/Locale/da_DK/translations.php
@@ -1313,4 +1313,5 @@ return array(
// 'TRL - Turkish Lira' => '',
// 'The project email is optional and could be used by several plugins.' => '',
// 'The email project must be unique across all projects' => '',
+ // 'The email configuration has been disabled by the administrator.' => '',
);
diff --git a/app/Locale/de_DE/translations.php b/app/Locale/de_DE/translations.php
index 9d1ff3bf..61175e33 100644
--- a/app/Locale/de_DE/translations.php
+++ b/app/Locale/de_DE/translations.php
@@ -1313,4 +1313,5 @@ return array(
// 'TRL - Turkish Lira' => '',
// 'The project email is optional and could be used by several plugins.' => '',
// 'The email project must be unique across all projects' => '',
+ // 'The email configuration has been disabled by the administrator.' => '',
);
diff --git a/app/Locale/el_GR/translations.php b/app/Locale/el_GR/translations.php
index a4750705..5e99a225 100644
--- a/app/Locale/el_GR/translations.php
+++ b/app/Locale/el_GR/translations.php
@@ -1313,4 +1313,5 @@ return array(
// 'TRL - Turkish Lira' => '',
// 'The project email is optional and could be used by several plugins.' => '',
// 'The email project must be unique across all projects' => '',
+ // 'The email configuration has been disabled by the administrator.' => '',
);
diff --git a/app/Locale/es_ES/translations.php b/app/Locale/es_ES/translations.php
index f84f1db1..2e3f4215 100644
--- a/app/Locale/es_ES/translations.php
+++ b/app/Locale/es_ES/translations.php
@@ -1313,4 +1313,5 @@ return array(
// 'TRL - Turkish Lira' => '',
// 'The project email is optional and could be used by several plugins.' => '',
// 'The email project must be unique across all projects' => '',
+ // 'The email configuration has been disabled by the administrator.' => '',
);
diff --git a/app/Locale/fi_FI/translations.php b/app/Locale/fi_FI/translations.php
index 40fddda4..84ddf1ce 100644
--- a/app/Locale/fi_FI/translations.php
+++ b/app/Locale/fi_FI/translations.php
@@ -1313,4 +1313,5 @@ return array(
// 'TRL - Turkish Lira' => '',
// 'The project email is optional and could be used by several plugins.' => '',
// 'The email project must be unique across all projects' => '',
+ // 'The email configuration has been disabled by the administrator.' => '',
);
diff --git a/app/Locale/fr_FR/translations.php b/app/Locale/fr_FR/translations.php
index 54df0379..8e062c45 100644
--- a/app/Locale/fr_FR/translations.php
+++ b/app/Locale/fr_FR/translations.php
@@ -1313,4 +1313,5 @@ return array(
'TRL - Turkish Lira' => 'TRL - Livre turque',
'The project email is optional and could be used by several plugins.' => 'L\'adresse email d\'un projet est optionnel et pourrait être utilisé par plusieurs extensions.',
'The email project must be unique across all projects' => 'L\'adresse email d\'un projet doit être unique pour tous les projets',
+ 'The email configuration has been disabled by the administrator.' => 'La configuration des emails a été désactivée par l\'administrateur.',
);
diff --git a/app/Locale/hu_HU/translations.php b/app/Locale/hu_HU/translations.php
index 2ad209a7..0d4beb00 100644
--- a/app/Locale/hu_HU/translations.php
+++ b/app/Locale/hu_HU/translations.php
@@ -1313,4 +1313,5 @@ return array(
// 'TRL - Turkish Lira' => '',
// 'The project email is optional and could be used by several plugins.' => '',
// 'The email project must be unique across all projects' => '',
+ // 'The email configuration has been disabled by the administrator.' => '',
);
diff --git a/app/Locale/id_ID/translations.php b/app/Locale/id_ID/translations.php
index 938c6bd7..78b15e98 100644
--- a/app/Locale/id_ID/translations.php
+++ b/app/Locale/id_ID/translations.php
@@ -1313,4 +1313,5 @@ return array(
// 'TRL - Turkish Lira' => '',
// 'The project email is optional and could be used by several plugins.' => '',
// 'The email project must be unique across all projects' => '',
+ // 'The email configuration has been disabled by the administrator.' => '',
);
diff --git a/app/Locale/it_IT/translations.php b/app/Locale/it_IT/translations.php
index 6d4ceaf9..93128cd2 100644
--- a/app/Locale/it_IT/translations.php
+++ b/app/Locale/it_IT/translations.php
@@ -1313,4 +1313,5 @@ return array(
// 'TRL - Turkish Lira' => '',
// 'The project email is optional and could be used by several plugins.' => '',
// 'The email project must be unique across all projects' => '',
+ // 'The email configuration has been disabled by the administrator.' => '',
);
diff --git a/app/Locale/ja_JP/translations.php b/app/Locale/ja_JP/translations.php
index 1c69d809..820d1b86 100644
--- a/app/Locale/ja_JP/translations.php
+++ b/app/Locale/ja_JP/translations.php
@@ -1313,4 +1313,5 @@ return array(
// 'TRL - Turkish Lira' => '',
// 'The project email is optional and could be used by several plugins.' => '',
// 'The email project must be unique across all projects' => '',
+ // 'The email configuration has been disabled by the administrator.' => '',
);
diff --git a/app/Locale/ko_KR/translations.php b/app/Locale/ko_KR/translations.php
index 1bf45633..56bac068 100644
--- a/app/Locale/ko_KR/translations.php
+++ b/app/Locale/ko_KR/translations.php
@@ -1313,4 +1313,5 @@ return array(
// 'TRL - Turkish Lira' => '',
// 'The project email is optional and could be used by several plugins.' => '',
// 'The email project must be unique across all projects' => '',
+ // 'The email configuration has been disabled by the administrator.' => '',
);
diff --git a/app/Locale/my_MY/translations.php b/app/Locale/my_MY/translations.php
index 588829d2..1121a880 100644
--- a/app/Locale/my_MY/translations.php
+++ b/app/Locale/my_MY/translations.php
@@ -1313,4 +1313,5 @@ return array(
// 'TRL - Turkish Lira' => '',
// 'The project email is optional and could be used by several plugins.' => '',
// 'The email project must be unique across all projects' => '',
+ // 'The email configuration has been disabled by the administrator.' => '',
);
diff --git a/app/Locale/nb_NO/translations.php b/app/Locale/nb_NO/translations.php
index 04d7c718..2743009c 100644
--- a/app/Locale/nb_NO/translations.php
+++ b/app/Locale/nb_NO/translations.php
@@ -1313,4 +1313,5 @@ return array(
// 'TRL - Turkish Lira' => '',
// 'The project email is optional and could be used by several plugins.' => '',
// 'The email project must be unique across all projects' => '',
+ // 'The email configuration has been disabled by the administrator.' => '',
);
diff --git a/app/Locale/nl_NL/translations.php b/app/Locale/nl_NL/translations.php
index 3bc9e51d..45a8c5bc 100644
--- a/app/Locale/nl_NL/translations.php
+++ b/app/Locale/nl_NL/translations.php
@@ -1313,4 +1313,5 @@ return array(
// 'TRL - Turkish Lira' => '',
// 'The project email is optional and could be used by several plugins.' => '',
// 'The email project must be unique across all projects' => '',
+ // 'The email configuration has been disabled by the administrator.' => '',
);
diff --git a/app/Locale/pl_PL/translations.php b/app/Locale/pl_PL/translations.php
index fdca3f07..b8c4a2c7 100644
--- a/app/Locale/pl_PL/translations.php
+++ b/app/Locale/pl_PL/translations.php
@@ -1313,4 +1313,5 @@ return array(
// 'TRL - Turkish Lira' => '',
// 'The project email is optional and could be used by several plugins.' => '',
// 'The email project must be unique across all projects' => '',
+ // 'The email configuration has been disabled by the administrator.' => '',
);
diff --git a/app/Locale/pt_BR/translations.php b/app/Locale/pt_BR/translations.php
index e709bb4a..a21e7cb8 100644
--- a/app/Locale/pt_BR/translations.php
+++ b/app/Locale/pt_BR/translations.php
@@ -1313,4 +1313,5 @@ return array(
// 'TRL - Turkish Lira' => '',
// 'The project email is optional and could be used by several plugins.' => '',
// 'The email project must be unique across all projects' => '',
+ // 'The email configuration has been disabled by the administrator.' => '',
);
diff --git a/app/Locale/pt_PT/translations.php b/app/Locale/pt_PT/translations.php
index b70d97d9..46c23f15 100644
--- a/app/Locale/pt_PT/translations.php
+++ b/app/Locale/pt_PT/translations.php
@@ -1313,4 +1313,5 @@ return array(
'TRL - Turkish Lira' => 'TRL - Lira Turca',
// 'The project email is optional and could be used by several plugins.' => '',
// 'The email project must be unique across all projects' => '',
+ // 'The email configuration has been disabled by the administrator.' => '',
);
diff --git a/app/Locale/ru_RU/translations.php b/app/Locale/ru_RU/translations.php
index 680340b1..9cd16716 100644
--- a/app/Locale/ru_RU/translations.php
+++ b/app/Locale/ru_RU/translations.php
@@ -1313,4 +1313,5 @@ return array(
// 'TRL - Turkish Lira' => '',
// 'The project email is optional and could be used by several plugins.' => '',
// 'The email project must be unique across all projects' => '',
+ // 'The email configuration has been disabled by the administrator.' => '',
);
diff --git a/app/Locale/sr_Latn_RS/translations.php b/app/Locale/sr_Latn_RS/translations.php
index 75678bca..3ebd5f68 100644
--- a/app/Locale/sr_Latn_RS/translations.php
+++ b/app/Locale/sr_Latn_RS/translations.php
@@ -1313,4 +1313,5 @@ return array(
// 'TRL - Turkish Lira' => '',
// 'The project email is optional and could be used by several plugins.' => '',
// 'The email project must be unique across all projects' => '',
+ // 'The email configuration has been disabled by the administrator.' => '',
);
diff --git a/app/Locale/sv_SE/translations.php b/app/Locale/sv_SE/translations.php
index 3f901a09..278c0f3c 100644
--- a/app/Locale/sv_SE/translations.php
+++ b/app/Locale/sv_SE/translations.php
@@ -1313,4 +1313,5 @@ return array(
// 'TRL - Turkish Lira' => '',
// 'The project email is optional and could be used by several plugins.' => '',
// 'The email project must be unique across all projects' => '',
+ // 'The email configuration has been disabled by the administrator.' => '',
);
diff --git a/app/Locale/th_TH/translations.php b/app/Locale/th_TH/translations.php
index 26497b0a..00a290da 100644
--- a/app/Locale/th_TH/translations.php
+++ b/app/Locale/th_TH/translations.php
@@ -1313,4 +1313,5 @@ return array(
// 'TRL - Turkish Lira' => '',
// 'The project email is optional and could be used by several plugins.' => '',
// 'The email project must be unique across all projects' => '',
+ // 'The email configuration has been disabled by the administrator.' => '',
);
diff --git a/app/Locale/tr_TR/translations.php b/app/Locale/tr_TR/translations.php
index c3947fed..dc25f861 100644
--- a/app/Locale/tr_TR/translations.php
+++ b/app/Locale/tr_TR/translations.php
@@ -1313,4 +1313,5 @@ return array(
// 'TRL - Turkish Lira' => '',
// 'The project email is optional and could be used by several plugins.' => '',
// 'The email project must be unique across all projects' => '',
+ // 'The email configuration has been disabled by the administrator.' => '',
);
diff --git a/app/Locale/zh_CN/translations.php b/app/Locale/zh_CN/translations.php
index 5f45188b..e49386df 100644
--- a/app/Locale/zh_CN/translations.php
+++ b/app/Locale/zh_CN/translations.php
@@ -1313,4 +1313,5 @@ return array(
// 'TRL - Turkish Lira' => '',
// 'The project email is optional and could be used by several plugins.' => '',
// 'The email project must be unique across all projects' => '',
+ // 'The email configuration has been disabled by the administrator.' => '',
);
diff --git a/app/Template/config/email.php b/app/Template/config/email.php
index bc2c2ae5..be729f5d 100644
--- a/app/Template/config/email.php
+++ b/app/Template/config/email.php
@@ -6,11 +6,15 @@
<fieldset>
<legend><?= t('Outgoing Emails') ?></legend>
- <?= $this->form->label(t('Email sender address'), 'mail_sender_address') ?>
- <?= $this->form->text('mail_sender_address', $values, $errors, array('placeholder="'.MAIL_FROM.'"')) ?>
+ <?php if (MAIL_CONFIGURATION): ?>
+ <?= $this->form->label(t('Email sender address'), 'mail_sender_address') ?>
+ <?= $this->form->text('mail_sender_address', $values, $errors, array('placeholder="'.MAIL_FROM.'"')) ?>
- <?= $this->form->label(t('Email transport'), 'mail_transport') ?>
- <?= $this->form->select('mail_transport', $mail_transports, $values, $errors) ?>
+ <?= $this->form->label(t('Email transport'), 'mail_transport') ?>
+ <?= $this->form->select('mail_transport', $mail_transports, $values, $errors) ?>
+ <?php else: ?>
+ <p class="alert"><?= t('The email configuration has been disabled by the administrator.') ?></p>
+ <?php endif ?>
</fieldset>
<?= $this->hook->render('template:config:email', array('values' => $values, 'errors' => $errors)) ?>
diff --git a/app/constants.php b/app/constants.php
index ba14cde6..d62bfd3a 100644
--- a/app/constants.php
+++ b/app/constants.php
@@ -98,6 +98,7 @@ defined('REVERSE_PROXY_DEFAULT_DOMAIN') or define('REVERSE_PROXY_DEFAULT_DOMAIN'
defined('REMEMBER_ME_AUTH') or define('REMEMBER_ME_AUTH', true);
// Mail configuration
+defined('MAIL_CONFIGURATION') or define('MAIL_CONFIGURATION', true);
defined('MAIL_FROM') or define('MAIL_FROM', 'notifications@kanboard.local');
defined('MAIL_TRANSPORT') or define('MAIL_TRANSPORT', 'mail');
defined('MAIL_SMTP_HOSTNAME') or define('MAIL_SMTP_HOSTNAME', '');
diff --git a/config.default.php b/config.default.php
index 9b55295f..1f08fbad 100644
--- a/config.default.php
+++ b/config.default.php
@@ -34,7 +34,10 @@ define('CACHE_DIR', DATA_DIR.DIRECTORY_SEPARATOR.'cache');
// Folder for uploaded files (must be writeable by the web server user)
define('FILES_DIR', DATA_DIR.DIRECTORY_SEPARATOR.'files');
-// E-mail address for the "From" header (notifications)
+// Enable/disable email configuration from the user interface
+define('MAIL_CONFIGURATION', true);
+
+// E-mail address used for the "From" header (notifications)
define('MAIL_FROM', 'replace-me@kanboard.local');
// Mail transport available: "smtp", "sendmail", "mail" (PHP mail function), "postmark", "mailgun", "sendgrid"
diff --git a/doc/en_US/config.markdown b/doc/en_US/config.markdown
index a2046989..4ccaec27 100644
--- a/doc/en_US/config.markdown
+++ b/doc/en_US/config.markdown
@@ -65,7 +65,10 @@ Email configuration
-------------------
```php
-// E-mail address for the "From" header (notifications)
+// Enable/disable email configuration from the user interface
+define('MAIL_CONFIGURATION', true);
+
+// E-mail address used for the "From" header (notifications)
define('MAIL_FROM', 'notifications@kanboard.local');
// Mail transport to use: "smtp", "sendmail" or "mail" (PHP mail function)
diff --git a/doc/tr_TR/config.markdown b/doc/tr_TR/config.markdown
index dc28fbdf..f09b4adf 100644
--- a/doc/tr_TR/config.markdown
+++ b/doc/tr_TR/config.markdown
@@ -65,7 +65,10 @@ E-posta yapılandırması
-------------------
```php
-// E-mail address for the "From" header (notifications)
+// Enable/disable email configuration from the user interface
+define('MAIL_CONFIGURATION', true);
+
+// E-mail address used for the "From" header (notifications)
define('MAIL_FROM', 'notifications@kanboard.local');
// Mail transport to use: "smtp", "sendmail" or "mail" (PHP mail function)