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

Encode passwords in emails send (#3566)

Jaap Marcus 2 лет назад
Родитель
Сommit
5cc024322b
6 измененных файлов с 23 добавлено и 16 удалено
  1. 3 3
      web/add/db/index.php
  2. 1 1
      web/add/mail/index.php
  3. 4 4
      web/add/user/index.php
  4. 6 1
      web/edit/mail/index.php
  5. 5 3
      web/edit/web/index.php
  6. 4 4
      web/reset/index.php

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

@@ -182,9 +182,9 @@ if (!empty($_POST["ok"])) {
 			: $_SESSION["APP_NAME"];
 
 		$mailtext = translate_email($template, [
-			"database" => $user_plain . "_" . $_POST["v_database"],
-			"username" => $user_plain . "_" . $_POST["v_dbuser"],
-			"password" => $_POST["v_password"],
+			"database" => htmlentities($user_plain . "_" . $_POST["v_database"]),
+			"username" => htmlentities($user_plain . "_" . $_POST["v_dbuser"]),
+			"password" => htmlentities($_POST["v_password"]),
 			"dbadmin" => $db_admin_link,
 			"appname" => $_SESSION["APP_NAME"],
 		]);

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

@@ -492,7 +492,7 @@ if (!empty($_POST["ok_acc"])) {
 		$mailtext = translate_email($template, [
 			"domain" => htmlentities($_POST["v_domain"]),
 			"account" => htmlentities(strtolower($_POST["v_account"])),
-			"password" => $_POST["v_password"],
+			"password" => htmlentities($_POST["v_password"]),
 			"webmail" => $webmail . "." . htmlentities($_POST["v_domain"]),
 			"hostname" => "mail." . htmlentities($_POST["v_domain"]),
 			"appname" => $_SESSION["APP_NAME"],

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

@@ -209,10 +209,10 @@ if (!empty($_POST["ok"])) {
 		}
 
 		$mailtext = translate_email($template, [
-			"name" => $name,
-			"user" => $_POST["v_username"],
-			"password" => $_POST["v_password"],
-			"hostname" => $hostname,
+			"name" => htmlentities($name),
+			"user" => htmlentities($_POST["v_username"]),
+			"password" => htmlentities($_POST["v_password"]),
+			"hostname" => htmlentities($hostname),
 			"appname" => $_SESSION["APP_NAME"],
 		]);
 

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

@@ -1069,6 +1069,11 @@ if (!empty($_POST["save"]) && !empty($_GET["domain"]) && !empty($_GET["account"]
 		}
 	}
 
+	$webmail = "http://" . $hostname . "/" . $v_webmail_alias . "/";
+	if (!empty($_SESSION["WEBMAIL_ALIAS"])) {
+		$webmail = $_SESSION["WEBMAIL_ALIAS"];
+	}
+
 	// Email login credentials
 	if (!empty($_POST["v_send_email"]) && empty($_SESSION["error_msg"])) {
 		$to = $_POST["v_send_email"];
@@ -1146,7 +1151,7 @@ if (!empty($_POST["save"]) && !empty($_GET["domain"]) && !empty($_GET["account"]
 		$mailtext = translate_email($template, [
 			"domain" => htmlentities($_POST["v_domain"]),
 			"account" => htmlentities(strtolower($_POST["v_account"])),
-			"password" => $_POST["v_password"],
+			"password" => htmlentities($_POST["v_password"]),
 			"webmail" => $webmail . "." . htmlentities($_POST["v_domain"]),
 			"hostname" => "mail." . htmlentities($_POST["v_domain"]),
 			"appname" => $_SESSION["APP_NAME"],

+ 5 - 3
web/edit/web/index.php

@@ -1267,9 +1267,11 @@ if (!empty($_POST["save"])) {
 						}
 
 						$mailtext = translate_email($template, [
-							"domain" => $v_domain,
-							"username" => $user_plain . "_" . $v_ftp_username_for_emailing,
-							"password" => $v_ftp_user_data["v_ftp_password"],
+							"domain" => htmlentities($v_domain),
+							"username" => htmlentities(
+								$user_plain . "_" . $v_ftp_username_for_emailing,
+							),
+							"password" => htmlentities($v_ftp_user_data["v_ftp_password"]),
 							"appname" => $_SESSION["APP_NAME"],
 						]);
 

+ 4 - 4
web/reset/index.php

@@ -123,10 +123,10 @@ if (!empty($_POST["user"]) && empty($_POST["code"])) {
 					$name = empty($data[$user]["NAME"]) ? $user : $data[$user]["NAME"];
 
 					$mailtext = translate_email($template, [
-						"name" => $name,
-						"hostname" => $hostname . $port,
-						"user" => $user,
-						"resetcode" => $rkey,
+						"name" => htmlentities($name),
+						"hostname" => htmlentities($hostname . $port),
+						"user" => htmlentities($user),
+						"resetcode" => htmlentities($rkey),
 						"appname" => $_SESSION["APP_NAME"],
 					]);