Просмотр исходного кода

Merge pull request #2819 from jaapmarcus/fix/2815-email-does-not-include-password

2815 [Bug] - Notification mail account dont include Password when creating
Jaap Marcus 3 лет назад
Родитель
Сommit
bb00bb8951

+ 1 - 2
install/deb/roundcube/main.inc.php

@@ -103,5 +103,4 @@ $config['default_pass'] = '%p';
 $config['smtp_host'] = 'localhost:587';
 
 // Log session authentication errors to <log_dir>/session or to syslog
-$config['log_session'] = true;
-?>
+$config['log_session'] = true;

+ 1 - 3
install/deb/roundcube/mimetypes.php

@@ -53,6 +53,4 @@ return array(
   's7z' => 'application/x-7z-compressed',
   'vcf' => 'text/vcard',
   'ics' => 'text/calendar',
-);
-
-?>
+);

+ 1 - 1
install/upgrade/manual/install_sieve.sh

@@ -68,7 +68,7 @@ if [ "$HAS_DOVECOT_SIEVE_INSTALLED" = "0" ]; then
     # roundcube install
     mkdir -p $RC_CONFIG_DIR/plugins/managesieve
     
-    cp -f $HESTIA_INSTALL_DIR/roundcube/plugins/config_managesieve.inc.php $RC_CONFIG_DIR/plugins/managesieve/config.inc.php
+    cp -f $HESTIA_COMMON_DIR/roundcube/plugins/config_managesieve.inc.php $RC_CONFIG_DIR/plugins/managesieve/config.inc.php
         ln -s $RC_CONFIG_DIR/plugins/managesieve/config.inc.php $RC_INSTALL_DIR/plugins/managesieve/config.inc.php
     
     # permission changes

+ 28 - 0
install/upgrade/versions/1.6.8.sh

@@ -0,0 +1,28 @@
+#!/bin/bash
+
+# Hestia Control Panel upgrade script for target version 1.6.8
+
+#######################################################################################
+#######                      Place additional commands below.                   #######
+#######################################################################################
+####### Pass through information to the end user in case of a issue or problem  #######
+#######                                                                         #######
+####### Use add_upgrade_message "My message here" to include a message          #######
+####### in the upgrade notification email. Example:                             #######
+#######                                                                         #######
+####### add_upgrade_message "My message here"                                   #######
+#######                                                                         #######
+####### You can use \n within the string to create new lines.                   #######
+#######################################################################################
+
+upgrade_config_set_value 'UPGRADE_UPDATE_WEB_TEMPLATES' 'no'
+upgrade_config_set_value 'UPGRADE_UPDATE_DNS_TEMPLATES' 'yes'
+upgrade_config_set_value 'UPGRADE_UPDATE_MAIL_TEMPLATES' 'no'
+upgrade_config_set_value 'UPGRADE_REBUILD_USERS' 'no'
+upgrade_config_set_value 'UPGRADE_UPDATE_FILEMANAGER_CONFIG' 'false'
+
+# Sync up config files #2819
+if [ -f "/etc/roundcube/config.inc.php" ]; then
+    sed -i "s/?>//" /etc/roundcube/config.inc.php
+    sed -i "s/?>//" /etc/roundcube/mimetypes.php    
+fi

+ 1 - 1
web/add/db/index.php

@@ -113,7 +113,7 @@ if (!empty($_POST['ok'])) {
     if ((!empty($v_db_email)) && (empty($_SESSION['error_msg']))) {
         $to = $v_db_email;
         $subject = _("Database Credentials");
-        $hostname = exec('hostname');
+        $hostname = get_hostname();
         $from = "noreply@".$hostname;
         $from_name = _('Hestia Control Panel');
         $mailtext = sprintf(_('DATABASE_READY'), $user_plain."_".$_POST['v_database'], $user_plain."_".$_POST['v_dbuser'], $_POST['v_password'], $db_admin_link);

+ 1 - 1
web/add/mail/index.php

@@ -286,7 +286,7 @@ if (!empty($_POST['ok_acc'])) {
     if ((!empty($v_send_email)) && (empty($_SESSION['error_msg']))) {
         $to = $v_send_email;
         $subject = _("Email Credentials");
-        $hostname = exec('hostname');
+        $hostname = get_hostname();
         $from = "noreply@".$hostname;
         $from_name = _('Hestia Control Panel');
         $mailtext = $v_credentials;

+ 1 - 1
web/add/user/index.php

@@ -111,7 +111,7 @@ if (!empty($_POST['ok'])) {
         putenv("LANGUAGE=".$_POST['v_language']);
 
         $subject = _("Welcome to Hestia Control Panel");
-        $hostname = exec('hostname');
+        $hostname = get_hostname();
         unset($output);
         $from = "noreply@".$hostname;
         $from_name = _('Hestia Control Panel');

+ 1 - 1
web/edit/mail/index.php

@@ -651,7 +651,7 @@ if ((!empty($_POST['save'])) && (!empty($_GET['domain'])) && (!empty($_GET['acco
     if ((!empty($v_send_email)) && (empty($_SESSION['error_msg']))) {
         $to = $v_send_email;
         $subject = _("Email Credentials");
-        $hostname = exec('hostname');
+        $hostname = get_hostname();
         $from = "noreply@".$hostname;
         $from_name = _('Hestia Control Panel');
         $mailtext = $v_credentials;

+ 2 - 2
web/edit/web/index.php

@@ -786,7 +786,7 @@ if (!empty($_POST['save'])) {
                     if ((!empty($v_ftp_user_data['v_ftp_email'])) && (empty($_SESSION['error_msg']))) {
                         $to = $v_ftp_user_data['v_ftp_email'];
                         $subject = _("FTP login credentials");
-                        $hostname = exec('hostname');
+                        $hostname = get_hostname();
                         $from = "noreply@".$hostname;
                         $from_name = _('Hestia Control Panel');
                         $mailtext = sprintf(_('FTP_ACCOUNT_READY'), escapeshellarg($_GET['domain']), $user, $v_ftp_username, $v_ftp_user_data['v_ftp_password']);
@@ -863,7 +863,7 @@ if (!empty($_POST['save'])) {
 
                     $to = $v_ftp_user_data['v_ftp_email'];
                     $subject = _("FTP login credentials");
-                    $hostname = exec('hostname');
+                    $hostname = get_hostname();
                     $from = "noreply@".$hostname;
                     $from_name = _('Hestia Control Panel');
                     $mailtext =  sprintf(_('FTP_ACCOUNT_READY'), escapeshellarg($_GET['domain']), $user, $v_ftp_username_for_emailing, $v_ftp_user_data['v_ftp_password']);

+ 17 - 0
web/inc/helpers.php

@@ -133,3 +133,20 @@ function hst_add_history_log($message, $category = 'System', $level = 'Info', $u
     return $return_var;
 }
 
+function get_hostname(){
+        $badValues = array(false, null, 0, '', "localhost", "127.0.0.1", "::1", "0000:0000:0000:0000:0000:0000:0000:0001");
+        $ret = gethostname();
+        if(in_array($ret, $badValues, true)){
+            throw new Exception('gethostname() failed');
+        }
+        $ret2 = gethostbyname($ret);
+        if(in_array($ret2, $badValues, true)){
+            return $ret;
+        }
+        $ret3 = gethostbyaddr($ret2);
+        if(in_array($ret3, $badValues, true)){
+            return $ret2;
+        }
+        return $ret3;
+}
+

+ 1 - 16
web/inc/mail-wrapper.php

@@ -27,22 +27,7 @@ if (!empty( $data['config']['LANGUAGE'])) {
 
 //define vars 
 //make hostname detection a bit more feature proof
-$hostname = (function():string{
-    $badValues = array(false, null, 0, '', "localhost", "127.0.0.1", "::1", "0000:0000:0000:0000:0000:0000:0000:0001");
-    $ret = gethostname();
-    if(in_array($ret, $badValues, true)){
-        throw new Exception('gethostname() failed');
-    }
-    $ret2 = gethostbyname($ret);
-    if(in_array($ret2, $badValues, true)){
-        return $ret;
-    }
-    $ret3 = gethostbyaddr($ret2);
-    if(in_array($ret3, $badValues, true)){
-        return $ret2;
-    }
-    return $ret3;
-})();
+$hostname = get_hostname();
 
 $from = 'noreply@'.$hostname;
 $from_name = _('Hestia Control Panel');

+ 3 - 7
web/js/pages/add_mail_acc.js

@@ -120,7 +120,7 @@ randomString = function(min_length = 16) {
         if($('input[name=v_password]').attr('type') == 'text')
             $('#v_password').text(randomstring);
         else
-            $('#v_password').text(Array(randomstring.length+1).join('*'));s        
+            $('#v_password').text(Array(randomstring.length+1).join('*'));      
         App.Actions.MAIL_ACC.update_v_password();
         generate_mail_credentials();
 }
@@ -128,8 +128,7 @@ randomString = function(min_length = 16) {
 generate_mail_credentials = function() {
     var div = $('.mail-infoblock').clone();
     div.find('#mail_configuration').remove();
-    var pass=div.find('#v_password').text();
-    if (pass=="") div.find('#v_password').text(' ');
+    var pass=$('#v_password').text();
     var output = div.text();
     output=output.replace(/(?:\r\n|\r|\n|\t)/g, "|");
     output=output.replace(/  /g, "");
@@ -163,10 +162,7 @@ $(document).ready(function() {
     });
 
     $('.toggle-psw-visibility-icon').click(function(){
-        if($('input[name=v_password]').attr('type') == 'text')
-            $('#v_password').text($('input[name=v_password]').val());
-        else
-            $('#v_password').text(Array($('input[name=v_password]').val().length+1).join('*'));
+        $('#v_password').text($('input[name=v_password]').val());
         generate_mail_credentials();
     });
 

+ 2 - 13
web/reset/index.php

@@ -43,20 +43,9 @@ if ((!empty($_POST['user'])) && (empty($_POST['code']))) {
                 $contact = $data[$user]['CONTACT'];
                 $to = $data[$user]['CONTACT'];
                 $subject = sprintf(_('MAIL_RESET_SUBJECT'), date("Y-m-d H:i:s"));
-                $hostname = exec('hostname');
-                $hostname_full = exec('hostname -f');
-                if ($hostname.":".$_SERVER['SERVER_PORT'] == $_SERVER['HTTP_HOST']) {
-                    $check = true; 
-                    $hostname_email = $hostname;
-                }else if ($hostname_full.":".$_SERVER['SERVER_PORT'] == $_SERVER['HTTP_HOST']) {
-                    $check = true;
-                    $hostname_email = $hostname_full;
-                }else{
-                    $check = false;
-                    $ERROR = "<a class=\"error\">"._('Invalid host domain')."</a>";
-                }
+                $hostname = get_hostname();
                 if ($check == true){
-                    $from = "noreply@".$hostname_email;
+                    $from = "noreply@".$hostname;
                     $from_name = _('Hestia Control Panel');
                     if (!empty($name)) {
                         $mailtext = sprintf(_('GREETINGS_GORDON'), $name);

+ 23 - 79
web/templates/pages/add_mail_acc.html

@@ -162,85 +162,29 @@
 				<td class="mail-infoblock-td">
 					<div class="mail-infoblock">
 						<table>
-							<?php $uname_arr=posix_uname(); $hostname=$uname_arr['nodename']; ?>
-							<tr>
-								<td colspan="2">
-									<select id="mail_configuration" class="vst-list flat">
-										<option v_type="hostname" domain="<?=htmlentities($v_domain)?>"><?=_('Use domain hostname');?></option>
-										<option v_type="starttls"><?=_('Use STARTTLS');?></option>
-										<option v_type="ssl"><?=_('Use SSL / TLS');?></option>
-										<option v_type="no_encryption" domain="<?=htmlentities(trim($v_domain, "'"))?>" no_encryption="<?=_('No encryption');?>"><?=_('No encryption');?></option>
-									</select>
-								</td>
-							</tr>
-							<tr>
-								<td><?=_('Username');?>:</td>
-								<td>
-									<div><span id="v_account">example</span>@<?=htmlentities(trim($v_domain, "'"))?></div>
-								</td>
-							</tr>
-							<tr>
-								<td><?=_('Password');?>:</td>
-								<td>
-									<div id="v_password">******</div>
-								</td>
-							</tr>
-							<tr>
-								<td><?=_('IMAP hostname');?>:</td>
-								<td>
-									<div id="td_imap_hostname">mail.<?=htmlentities($v_domain)?></div>
-								</td>
-							</tr>
-							<tr>
-								<td><?=_('IMAP port');?>:</td>
-								<td>
-									<div id="td_imap_port">143</div>
-								</td>
-							</tr>
-							<tr>
-								<td><?=_('IMAP security');?>:</td>
-								<td>
-									<div id="td_imap_encryption"><?=_('STARTTLS');?></div>
-								</td>
-							</tr>
-							<tr>
-								<td><?=_('IMAP auth method');?>:</td>
-								<td>
-									<div><?=_('Normal password');?></div>
-								</td>
-							</tr>
-							<tr>
-								<td><?=_('SMTP hostname');?>:</td>
-								<td>
-									<div id="td_smtp_hostname">mail.<?=htmlentities($v_domain)?></div>
-								</td>
-							</tr>
-							<tr>
-								<td><?=_('SMTP port');?>:</td>
-								<td>
-									<div id="td_smtp_port">587</div>
-								</td>
-							</tr>
-							<tr>
-								<td><?=_('SMTP security');?>:</td>
-								<td>
-									<div id="td_smtp_encryption"><?=_('STARTTLS');?></div>
-								</td>
-							</tr>
-							<tr>
-								<td><?=_('SMTP auth method');?>:</td>
-								<td>
-									<div><?=_('Normal password');?></div>
-								</td>
-							</tr>
-							<?php if ($_SESSION['WEBMAIL_SYSTEM']) {?>
-								<tr>
-									<td><?=_('Webmail URL');?>:</td>
-									<td>
-										<div><a class="vst" href="http://<?=htmlentities($v_webmail_alias)?>" target="_blank">http://<?=htmlentities($v_webmail_alias)?> <i></i></a></div>
-									</td>
-								</tr>
-							<?php } ?>
+						<tr><td colspan="2"><strong><?=strtoupper(_('Common account settings'));?></strong></td><tr>
+						<tr><td><?=_('Username');?>: </td><td><span id="v_account">example</span>@<?=htmlentities(trim($v_domain, "'"))?></td></tr>
+						<tr><td><?=_('Password');?>: </td><td><span id="v_password"></span></td></tr>
+						<?php if ($_SESSION['WEBMAIL_SYSTEM']) {?><tr><td><?=_('Webmail');?>: </td><td><a class="vst" href="http://<?=htmlentities($v_webmail_alias)?>" target="_blank">http://<?=htmlentities($v_webmail_alias)?></a></td></tr><?php } ?>
+						<tr><td><?=_('Hostname');?>: </td><td>mail.<?=htmlentities($v_domain)?></td></tr>	
+							
+						<tr><td colspan="2"><strong><?=strtoupper(_('IMAP settings'));?></strong></td></tr>
+						<tr><td><?=_('Authentication');?>: </td><td> <?=_('Normal password');?></td></tr>
+						<tr><td><?=_('SSL/TLS');?>: </td><td><?=_('Port');?> 993
+						<tr><td><?=_('STARTTLS');?>: </td><td><?=_('Port');?> 143
+						<tr><td><?=_('No encryption');?>: </td><td><?=_('Port');?> 143
+							
+						<tr><td colspan="2"><strong><?=strtoupper(_('POP3 settings'));?></strong></td></tr>
+						<tr><td><?=_('Authentication');?>: </td><td> <?=_('Normal password');?></td></tr>
+						<tr><td><?=_('SSL/TLS');?>: </td><td><?=_('Port');?> 995
+						<tr><td><?=_('STARTTLS');?>: </td><td><?=_('Port');?> 110
+						<tr><td><?=_('No encryption');?>: </td><td><?=_('Port');?> 110
+						
+						<tr><td colspan="2"><strong><?=strtoupper(_('SMTP settings'));?></strong></td></tr>
+						<tr><td><?=_('Authentication');?>: </td><td> <?=_('Normal password');?></td></tr>
+						<tr><td><?=_('SSL/TLS');?>: </td><td><?=_('Port');?> 465
+						<tr><td><?=_('STARTTLS');?>: </td><td><?=_('Port');?> 587
+						<tr><td><?=_('No encryption');?>: </td><td><?=_('Port');?> 25
 						</table>
 					</div>
 				</td>

+ 23 - 79
web/templates/pages/edit_mail_acc.html

@@ -170,85 +170,29 @@
 				<td class="mail-infoblock-td">
 					<div class="mail-infoblock">
 						<table>
-							<?php $uname_arr=posix_uname(); $hostname=$uname_arr['nodename']; ?>
-							<tr>
-								<td colspan="2">
-									<select id="mail_configuration" class="vst-list flat">
-										<option v_type="hostname" domain="<?='mail.'.$v_domain?>"><?=_('Use domain hostname');?></option>
-										<option v_type="starttls"><?=_('Use STARTTLS');?></option>
-										<option v_type="ssl"><?=_('Use SSL / TLS');?></option>
-										<option v_type="no_encryption" domain="<?=htmlentities(trim('mail.'.$v_domain, "'"))?>" no_encryption="<?=_('No encryption');?>"><?=_('No encryption');?></option>
-									</select>
-								</td>
-							</tr>
-							<tr>
-								<td><?=_('Username');?>:</td>
-								<td>
-									<div><span id="v_account">example</span>@<?=htmlentities(trim($v_domain, "'"))?></div>
-								</td>
-							</tr>
-							<tr>
-								<td><?=_('Password');?>:</td>
-								<td>
-									<div id="v_password">******</div>
-								</td>
-							</tr>
-							<tr>
-								<td><?=_('IMAP hostname');?>:</td>
-								<td>
-									<div id="td_imap_hostname">mail.<?=htmlentities($v_domain)?></div>
-								</td>
-							</tr>
-							<tr>
-								<td><?=_('IMAP port');?>:</td>
-								<td>
-									<div id="td_imap_port">143</div>
-								</td>
-							</tr>
-							<tr>
-								<td><?=_('IMAP security');?>:</td>
-								<td>
-									<div id="td_imap_encryption"><?=_('STARTTLS');?></div>
-								</td>
-							</tr>
-							<tr>
-								<td><?=_('IMAP auth method');?>:</td>
-								<td>
-									<div><?=_('Normal password');?></div>
-								</td>
-							</tr>
-							<tr>
-								<td><?=_('SMTP hostname');?>:</td>
-								<td>
-									<div id="td_smtp_hostname">mail.<?=htmlentities($v_domain)?></div>
-								</td>
-							</tr>
-							<tr>
-								<td><?=_('SMTP port');?>:</td>
-								<td>
-									<div id="td_smtp_port">587</div>
-								</td>
-							</tr>
-							<tr>
-								<td><?=_('SMTP security');?>:</td>
-								<td>
-									<div id="td_smtp_encryption"><?=_('STARTTLS');?></div>
-								</td>
-							</tr>
-							<tr>
-								<td><?=_('SMTP auth method');?>:</td>
-								<td>
-									<div><?=_('Normal password');?></div>
-								</td>
-							</tr>
-							<?php if ($_SESSION['WEBMAIL_SYSTEM']) { ?>
-								<tr>
-									<td><?=_('Webmail URL');?>:</td>
-									<td>
-										<div><a class="vst" href="http://<?=htmlentities($v_webmail_alias)?>" target="_blank">http://<?=htmlentities($v_webmail_alias)?> <i></i></a></div>
-									</td>
-								</tr>
-							<?php } ?>
+						<tr><td colspan="2"><strong><?=strtoupper(_('Common account settings'));?></strong></td><tr>
+						<tr><td><?=_('Username');?>: </td><td><span id="v_account"></span>@<?=htmlentities(trim($v_domain, "'"))?></td></tr>
+						<tr><td><?=_('Password');?>: </td><td><span id="v_password"></span></td></tr>
+						<?php if ($_SESSION['WEBMAIL_SYSTEM']) {?><tr><td><?=_('Webmail');?>: </td><td><a class="vst" href="http://<?=htmlentities($v_webmail_alias)?>" target="_blank">http://<?=htmlentities($v_webmail_alias)?></a></td></tr><?php } ?>
+						<tr><td><?=_('Hostname');?>: </td><td>mail.<?=htmlentities($v_domain)?></td></tr>	
+							
+						<tr><td colspan="2"><strong><?=strtoupper(_('IMAP settings'));?></strong></td></tr>
+						<tr><td><?=_('Authentication');?>: </td><td> <?=_('Normal password');?></td></tr>
+						<tr><td><?=_('SSL/TLS');?>: </td><td><?=_('Port');?> 993
+						<tr><td><?=_('STARTTLS');?>: </td><td><?=_('Port');?> 143
+						<tr><td><?=_('No encryption');?>: </td><td><?=_('Port');?> 143
+							
+						<tr><td colspan="2"><strong><?=strtoupper(_('POP3 settings'));?></strong></td></tr>
+						<tr><td><?=_('Authentication');?>: </td><td> <?=_('Normal password');?></td></tr>
+						<tr><td><?=_('SSL/TLS');?>: </td><td><?=_('Port');?> 995
+						<tr><td><?=_('STARTTLS');?>: </td><td><?=_('Port');?> 110
+						<tr><td><?=_('No encryption');?>: </td><td><?=_('Port');?> 110
+						
+						<tr><td colspan="2"><strong><?=strtoupper(_('SMTP settings'));?></strong></td></tr>
+						<tr><td><?=_('Authentication');?>: </td><td> <?=_('Normal password');?></td></tr>
+						<tr><td><?=_('SSL/TLS');?>: </td><td><?=_('Port');?> 465
+						<tr><td><?=_('STARTTLS');?>: </td><td><?=_('Port');?> 587
+						<tr><td><?=_('No encryption');?>: </td><td><?=_('Port');?> 25
 						</table>
 					</div>
 				</td>