Add configuration parameter to disable email configuration from user interface

This commit is contained in:
Frederic Guillot 2017-02-05 11:54:27 -05:00
parent a2e2ab8997
commit d0a1ed9227
32 changed files with 58 additions and 14 deletions

View File

@ -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

View File

@ -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;

View File

@ -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.' => '',
);

View File

@ -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.' => '',
);

View File

@ -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.' => '',
);

View File

@ -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.' => '',
);

View File

@ -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.' => '',
);

View File

@ -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.' => '',
);

View File

@ -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.' => '',
);

View File

@ -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.',
);

View File

@ -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.' => '',
);

View File

@ -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.' => '',
);

View File

@ -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.' => '',
);

View File

@ -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.' => '',
);

View File

@ -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.' => '',
);

View File

@ -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.' => '',
);

View File

@ -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.' => '',
);

View File

@ -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.' => '',
);

View File

@ -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.' => '',
);

View File

@ -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.' => '',
);

View File

@ -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.' => '',
);

View File

@ -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.' => '',
);

View File

@ -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.' => '',
);

View File

@ -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.' => '',
);

View File

@ -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.' => '',
);

View File

@ -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.' => '',
);

View File

@ -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.' => '',
);

View File

@ -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)) ?>

View File

@ -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', '');

View File

@ -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"

View File

@ -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)

View File

@ -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)