Skip to content

Commit 7b17e45

Browse files
author
mcramer
committed
Bugfix: SMTP password was visible in html source
Bugfix: Show error message on smtp enabled without administrator mail / name
1 parent 147b6f7 commit 7b17e45

File tree

4 files changed

+24
-2
lines changed

4 files changed

+24
-2
lines changed

interface/web/admin/lib/lang/de_system_config.lng

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<?php
22
$wb['system_config_desc_txt'] = '';
3+
$wb['smtp_missing_admin_mail_txt'] = 'Bitte geben Sie die Administrator E-Mail und den Namen ein, wenn Sie SMTP Versand nutzen wollen.';
34
$wb['warning'] = 'Bearbeiten Sie diese Werte sorgfältig! Entfernen Sie die Prefixe nicht auf Systemen mit mehr als einem Client.';
45
$wb['dbname_prefix_txt'] = 'Datenbanknamen Prefix';
56
$wb['dbuser_prefix_txt'] = 'Datenbankbenutzer Prefix';

interface/web/admin/lib/lang/en_system_config.lng

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<?php
22
$wb['system_config_desc_txt'] = '';
3+
$wb['smtp_missing_admin_mail_txt'] = 'Please enter the admin name and admin mail address if you want to use smtp mail sending.';
34
$wb['dashboard_atom_url_admin_txt'] = 'Dashboard atom feed URL (admin)';
45
$wb['dashboard_atom_url_reseller_txt'] = 'Dashboard atom feed URL (reseller)';
56
$wb['dashboard_atom_url_client_txt'] = 'Dashboard atom feed URL (client)';

interface/web/admin/system_config_edit.php

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,25 @@ function onShowEdit() {
7777
$app->tpl->setVar($record);
7878
}
7979

80+
function onSubmit() {
81+
global $app;
82+
83+
$app->uses('ini_parser,getconf');
84+
85+
$section = $app->tform->getCurrentTab();
86+
87+
$server_config_array = $app->getconf->get_global_config();
88+
$new_config = $app->tform->encode($this->dataRecord,$section);
89+
if($section == 'mail') {
90+
if($new_config['smtp_pass'] == '') $new_config['smtp_pass'] = $server_config_array['smtp_pass'];
91+
if($new_config['smtp_enabled'] == 'y' && ($new_config['admin_mail'] == '' || $new_config['admin_name'] == '')) {
92+
$app->tform->errorMessage .= $app->tform->lng("smtp_missing_admin_mail_txt");
93+
}
94+
}
95+
96+
parent::onSubmit();
97+
}
98+
8099
function onUpdateSave($sql) {
81100
global $app,$conf;
82101

@@ -85,7 +104,6 @@ function onUpdateSave($sql) {
85104

86105
$section = $app->tform->getCurrentTab();
87106

88-
89107
$server_config_array = $app->getconf->get_global_config();
90108
$new_config = $app->tform->encode($this->dataRecord,$section);
91109
if($section == 'sites' && $new_config['vhost_subdomains'] != 'y' && $server_config_array['vhost_subdomains'] == 'y') {
@@ -94,6 +112,8 @@ function onUpdateSave($sql) {
94112
if($check['cnt'] > 0) {
95113
$new_config['vhost_subdomains'] = 'y';
96114
}
115+
} elseif($section == 'mail') {
116+
if($new_config['smtp_pass'] == '') $new_config['smtp_pass'] = $server_config_array['smtp_pass'];
97117
}
98118
$server_config_array[$section] = $new_config;
99119
$server_config_str = $app->ini_parser->get_ini_string($server_config_array);

interface/web/admin/templates/system_config_mail_edit.htm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ <h2><tmpl_var name="list_head_txt"></h2>
5959
</div>
6060
<div class="ctrlHolder">
6161
<label for="smtp_pass">{tmpl_var name='smtp_pass_txt'}</label>
62-
<input name="smtp_pass" id="smtp_pass" value="{tmpl_var name='smtp_pass'}" size="30" maxlength="255" type="password" class="textInput" />
62+
<input name="smtp_pass" id="smtp_pass" value="" size="30" maxlength="255" type="password" class="textInput" />
6363
</div>
6464
<div class="ctrlHolder">
6565
<p class="label">{tmpl_var name='smtp_crypt_txt'}</p>

0 commit comments

Comments
 (0)