summaryrefslogtreecommitdiff
path: root/resources/views
diff options
context:
space:
mode:
authorGreg Roach <fisharebest@webtrees.net>2019-09-20 22:05:27 +0100
committerGreg Roach <fisharebest@webtrees.net>2019-09-20 22:05:27 +0100
commit1dcac87eebe70674246739db6483615674aa122a (patch)
treefe60eafe49798c78c60dfe21aff7c8fd88ed9fcc /resources/views
parent4ff24174de10283a6e1a914f1b81da0a22a528ff (diff)
downloadwebtrees-1dcac87eebe70674246739db6483615674aa122a.tar.gz
webtrees-1dcac87eebe70674246739db6483615674aa122a.tar.bz2
webtrees-1dcac87eebe70674246739db6483615674aa122a.zip
Add checks/warnings to email settings page
Diffstat (limited to 'resources/views')
-rw-r--r--resources/views/admin/site-mail.phtml122
1 files changed, 88 insertions, 34 deletions
diff --git a/resources/views/admin/site-mail.phtml b/resources/views/admin/site-mail.phtml
index 67259bbecd..f75f241b54 100644
--- a/resources/views/admin/site-mail.phtml
+++ b/resources/views/admin/site-mail.phtml
@@ -1,6 +1,27 @@
-<?php use Fisharebest\Webtrees\I18N; ?>
-<?php use Fisharebest\Webtrees\Site; ?>
-<?php use Fisharebest\Webtrees\View; ?>
+<?php
+
+use Fisharebest\Webtrees\I18N;
+use Fisharebest\Webtrees\View;
+
+/**
+ * @var string $DKIM_DOMAIN
+ * @var string $DKIM_KEY
+ * @var string $DKIM_SELECTOR
+ * @var string $SMTP_ACTIVE
+ * @var string $SMTP_AUTH
+ * @var string $SMTP_AUTH_USER
+ * @var string $SMTP_FROM_NAME
+ * @var string $SMTP_HELO
+ * @var string $SMTP_HOST
+ * @var string $SMTP_PORT
+ * @var string $SMTP_SSL
+ * @var string[] $mail_ssl_options
+ * @var string[] $mail_transport_options
+ * @var bool $smtp_helo_valid
+ * @var bool $smtp_from_name_valid
+ * @var string $title
+ */
+?>
<?= view('components/breadcrumbs', ['links' => [route('admin-control-panel') => I18N::translate('Control panel'), $title]]) ?>
@@ -15,25 +36,35 @@
<div class="row form-group">
<label for="SMTP_ACTIVE" class="col-sm-3 col-form-label">
- <?= /* I18N: A configuration setting */ I18N::translate('Messages') ?>
+ <?= /* I18N: A configuration setting */
+ I18N::translate('Messages') ?>
</label>
<div class="col-sm-9">
- <?= view('components/select', ['name' => 'SMTP_ACTIVE', 'selected' => Site::getPreference('SMTP_ACTIVE'), 'options' => $mail_transport_options]) ?>
+ <?= view('components/select', ['name' => 'SMTP_ACTIVE', 'selected' => $SMTP_ACTIVE, 'options' => $mail_transport_options]) ?>
<p class="small text-muted">
- <?= /* I18N: Help text for the “Messages” site configuration setting */ I18N::translate('webtrees needs to send emails, such as password reminders and website notifications. To do this, it can use this server’s built in PHP mail facility (which is not always available) or an external SMTP (mail-relay) service, for which you will need to provide the connection details.') ?>
+ <?= /* I18N: Help text for the “Messages” site configuration setting */
+ I18N::translate('webtrees needs to send emails, such as password reminders and website notifications.') ?>
</p>
</div>
</div>
<div class="row form-group">
<label for="SMTP_FROM_NAME" class="col-sm-3 col-form-label">
- <?= /* I18N: A configuration setting */ I18N::translate('Sender name') ?>
+ <?= /* I18N: A configuration setting */
+ I18N::translate('Sender name') ?>
</label>
<div class="col-sm-9">
- <input type="email" class="form-control" id="SMTP_FROM_NAME" name="SMTP_FROM_NAME" value="<?= e(Site::getPreference('SMTP_FROM_NAME')) ?>" placeholder="no-reply@localhost" maxlength="255">
+ <input type="email" class="form-control" id="SMTP_FROM_NAME" name="SMTP_FROM_NAME" value="<?= e($SMTP_FROM_NAME) ?>" maxlength="255">
<p class="small text-muted">
- <?= /* I18N: Help text for the “Sender name” site configuration setting */ I18N::translate('This name is used in the “From” field, when sending automatic emails from this server.') ?>
+ <?= /* I18N: Help text for the “Sender name” site configuration setting */
+ I18N::translate('This name is used in the “From” field, when sending automatic emails from this server.') ?>
+ </p>
+
+ <?php if (!$smtp_from_name_valid) : ?>
+ <p class="alert alert-warning">
+ <?= I18N::translate('Most mail servers require a valid email address.') ?>
</p>
+ <?php endif ?>
</div>
</div>
@@ -41,24 +72,28 @@
<div class="row form-group">
<label for="SMTP_HOST" class="col-sm-3 col-form-label">
- <?= /* I18N: A configuration setting */ I18N::translate('Server name') ?>
+ <?= /* I18N: A configuration setting */
+ I18N::translate('Server name') ?>
</label>
<div class="col-sm-9">
- <input type="text" class="form-control" id="SMTP_HOST" name="SMTP_HOST" value="<?= e(Site::getPreference('SMTP_HOST')) ?>" placeholder="smtp.example.com" maxlength="255" pattern="[a-z0-9-]+(\.[a-z0-9-]+)*">
+ <input type="text" class="form-control" id="SMTP_HOST" name="SMTP_HOST" value="<?= e($SMTP_HOST) ?>" placeholder="smtp.example.com" maxlength="255" pattern="[a-z0-9-]+(\.[a-z0-9-]+)*">
<p class="small text-muted">
- <?= /* I18N: Help text for the “Server name” site configuration setting */ I18N::translate('This is the name of the SMTP server. “localhost” means that the mail service is running on the same computer as your web server.') ?>
+ <?= /* I18N: Help text for the “Server name” site configuration setting */
+ I18N::translate('This is the name of the SMTP server. “localhost” means that the mail service is running on the same computer as your web server.') ?>
</p>
</div>
</div>
<div class="row form-group">
<label for="SMTP_PORT" class="col-sm-3 col-form-label">
- <?= /* I18N: A configuration setting */ I18N::translate('Port number') ?>
+ <?= /* I18N: A configuration setting */
+ I18N::translate('Port number') ?>
</label>
<div class="col-sm-9">
- <input type="text" class="form-control" id="SMTP_PORT" name="SMTP_PORT" value="<?= e(Site::getPreference('SMTP_PORT')) ?>" pattern="[0-9]*" placeholder="25" maxlength="5">
+ <input type="text" class="form-control" id="SMTP_PORT" name="SMTP_PORT" value="<?= e($SMTP_PORT) ?>" pattern="[0-9]*" placeholder="25" maxlength="5">
<p class="small text-muted">
- <?= /* I18N: Help text for the "Port number" site configuration setting */ I18N::translate('By default, SMTP works on port 25.') ?>
+ <?= /* I18N: Help text for the "Port number" site configuration setting */
+ I18N::translate('By default, SMTP works on port 25.') ?>
</p>
</div>
</div>
@@ -66,12 +101,14 @@
<fieldset class="form-group">
<div class="row">
<legend class="col-form-label col-sm-3">
- <?= /* I18N: A configuration setting */ I18N::translate('Use password') ?>
+ <?= /* I18N: A configuration setting */
+ I18N::translate('Use password') ?>
</legend>
<div class="col-sm-9">
- <?= view('components/radios-inline', ['name' => 'SMTP_AUTH', 'options' => [I18N::translate('no'), I18N::translate('yes')], 'selected' => (int) Site::getPreference('SMTP_AUTH')]) ?>
+ <?= view('components/radios-inline', ['name' => 'SMTP_AUTH', 'options' => [I18N::translate('no'), I18N::translate('yes')], 'selected' => (int) $SMTP_AUTH]) ?>
<p class="small text-muted">
- <?= /* I18N: Help text for the “Use password” site configuration setting */ I18N::translate('Most SMTP servers require a password.') ?>
+ <?= /* I18N: Help text for the “Use password” site configuration setting */
+ I18N::translate('Most SMTP servers require a password.') ?>
</p>
</div>
</div>
@@ -79,54 +116,69 @@
<div class="row form-group">
<label for="SMTP_AUTH_USER" class="col-sm-3 col-form-label">
- <?= /* I18N: A configuration setting */ I18N::translate('Username') ?>
+ <?= /* I18N: A configuration setting */
+ I18N::translate('Username') ?>
</label>
<div class="col-sm-9">
- <input type="text" class="form-control" id="SMTP_AUTH_USER" name="SMTP_AUTH_USER" value="<?= e(Site::getPreference('SMTP_AUTH_USER')) ?>" maxlength="255">
+ <input type="text" class="form-control" id="SMTP_AUTH_USER" name="SMTP_AUTH_USER" value="<?= e($SMTP_AUTH_USER) ?>" maxlength="255">
<p class="small text-muted">
- <?= /* I18N: Help text for the "Username" site configuration setting */ I18N::translate('The username required for authentication with the SMTP server.') ?>
+ <?= /* I18N: Help text for the "Username" site configuration setting */
+ I18N::translate('The username required for authentication with the SMTP server.') ?>
</p>
</div>
</div>
<div class="row form-group">
<label for="SMTP_AUTH_PASS" class="col-sm-3 col-form-label">
- <?= /* I18N: A configuration setting */ I18N::translate('Password') ?>
+ <?= /* I18N: A configuration setting */
+ I18N::translate('Password') ?>
</label>
<div class="col-sm-9">
<input type="password" class="form-control" id="SMTP_AUTH_PASS" name="SMTP_AUTH_PASS" value="" autocomplete="off">
<p class="small text-muted">
- <?= /* I18N: Help text for the "Password" site configuration setting */ I18N::translate('The password required for authentication with the SMTP server.') ?>
+ <?= /* I18N: Help text for the "Password" site configuration setting */
+ I18N::translate('The password required for authentication with the SMTP server.') ?>
</p>
</div>
</div>
<div class="row form-group">
<label for="SMTP_SSL" class="col-sm-3 col-form-label">
- <?= /* I18N: A configuration setting */ I18N::translate('Secure connection') ?>
+ <?= /* I18N: A configuration setting */
+ I18N::translate('Secure connection') ?>
</label>
<div class="col-sm-9">
- <?= view('components/select', ['name' => 'SMTP_SSL', 'selected' => Site::getPreference('SMTP_SSL'), 'options' => $mail_ssl_options]) ?>
+ <?= view('components/select', ['name' => 'SMTP_SSL', 'selected' => $SMTP_SSL, 'options' => $mail_ssl_options]) ?>
<p class="small text-muted">
- <?= /* I18N: Help text for the “Secure connection” site configuration setting */ I18N::translate('Most servers do not use secure connections.') ?>
+ <?= /* I18N: Help text for the “Secure connection” site configuration setting */
+ I18N::translate('Most servers do not use secure connections.') ?>
</p>
</div>
</div>
<div class="row form-group">
<label for="SMTP_HELO" class="col-sm-3 col-form-label">
- <?= /* I18N: A configuration setting */ I18N::translate('Sending server name') ?>
+ <?= /* I18N: A configuration setting */
+ I18N::translate('Sending server name') ?>
</label>
<div class="col-sm-9">
- <input type="text" class="form-control" id="SMTP_HELO" name="SMTP_HELO" value="<?= e(Site::getPreference('SMTP_HELO')) ?>" placeholder="localhost" maxlength="255" pattern="[a-z0-9-]+(\.[a-z0-9-]+)*">
+ <input type="text" class="form-control" id="SMTP_HELO" name="SMTP_HELO" value="<?= e($SMTP_HELO) ?>" maxlength="255" pattern="[a-z0-9-]+(\.[a-z0-9-]+)*">
<p class="small text-muted">
- <?= /* I18N: Help text for the "Sending server name" site configuration setting */ I18N::translate('Many mail servers require that the sending server identifies itself correctly, using a valid domain name.') ?>
+ <?= /* I18N: Help text for the "Sending server name" site configuration setting */
+ I18N::translate('Most mail servers require that the sending server identifies itself correctly, using a valid domain name.') ?>
</p>
+
+ <?php if (!$smtp_helo_valid) : ?>
+ <p class="alert alert-warning">
+ <?= I18N::translate('Most mail servers require a valid domain name.') ?>
+ </p>
+ <?php endif ?>
</div>
</div>
<h2>
- <?= /* I18N: https://en.wikipedia.org/wiki/DomainKeys_Identified_Mail */ I18N::translate('DKIM digital signature') ?>
+ <?= /* I18N: https://en.wikipedia.org/wiki/DomainKeys_Identified_Mail */
+ I18N::translate('DKIM digital signature') ?>
</h2>
<div class="row form-group">
@@ -134,7 +186,7 @@
<?= I18N::translate('Domain name') ?>
</label>
<div class="col-sm-9">
- <input type="text" class="form-control" id="DKIM_DOMAIN" name="DKIM_DOMAIN" value="<?= e(Site::getPreference('DKIM_DOMAIN')) ?>" maxlength="255">
+ <input type="text" class="form-control" id="DKIM_DOMAIN" name="DKIM_DOMAIN" value="<?= e($DKIM_DOMAIN) ?>" maxlength="255">
</div>
</div>
@@ -143,7 +195,7 @@
<?= I18N::translate('Selector') ?>
</label>
<div class="col-sm-9">
- <input type="text" class="form-control" id="DKIM_SELECTOR" name="DKIM_SELECTOR" value="<?= e(Site::getPreference('DKIM_SELECTOR')) ?>" maxlength="255">
+ <input type="text" class="form-control" id="DKIM_SELECTOR" name="DKIM_SELECTOR" value="<?= e($DKIM_SELECTOR) ?>" maxlength="255">
</div>
</div>
@@ -152,10 +204,12 @@
<?= I18N::translate('Private key') ?>
</label>
<div class="col-sm-9">
- <textarea class="form-control" id="DKIM_KEY" name="DKIM_KEY"><?= e(Site::getPreference('DKIM_KEY')) ?></textarea>
+ <textarea class="form-control" id="DKIM_KEY" name="DKIM_KEY"><?= e($DKIM_KEY) ?></textarea>
</div>
</div>
+ <hr>
+
<div class="row form-group">
<div class="offset-sm-3 col-sm-9">
<button type="submit" class="btn btn-primary">
@@ -173,6 +227,6 @@
<?php View::push('javascript') ?>
<script>
- $('#SMTP_AUTH_PASS').hideShowPassword('infer', true);
+ $("#SMTP_AUTH_PASS").hideShowPassword("infer", true);
</script>
<?php View::endpush() ?>