From 9b0ee8d9832edd60b772ee11a18f2e1c4f39e8cf Mon Sep 17 00:00:00 2001
From: Marius Cramer <m.cramer@pixcept.de>
Date: Tue, 03 Feb 2015 04:10:04 -0500
Subject: [PATCH] Merge branch 'master' of git.ispconfig.org:ispconfig/ispconfig3

---
 interface/web/sites/database_user_edit.php |   15 +++++++++++++--
 1 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/interface/web/sites/database_user_edit.php b/interface/web/sites/database_user_edit.php
index 6916e26..18b46b9 100644
--- a/interface/web/sites/database_user_edit.php
+++ b/interface/web/sites/database_user_edit.php
@@ -103,8 +103,11 @@
 			$app->tpl->setVar("database_user", $app->tools_sites->removePrefix($this->dataRecord['database_user'], $this->dataRecord['database_user_prefix'], $dbuser_prefix));
 		}
 
-
-		$app->tpl->setVar("database_user_prefix", $app->tools_sites->getPrefix($this->dataRecord['database_user_prefix'], $dbuser_prefix, $global_config['dbuser_prefix']));
+		if($this->dataRecord['database_user'] == "") {
+			$app->tpl->setVar("database_user_prefix", $dbuser_prefix);
+		} else {
+			$app->tpl->setVar("database_user_prefix", $app->tools_sites->getPrefix($this->dataRecord['database_user_prefix'], $dbuser_prefix, $global_config['dbuser_prefix']));
+		}
 
 		parent::onShowEnd();
 	}
@@ -147,6 +150,11 @@
 			$this->dataRecord['database_user'] = substr($dbuser_prefix . $this->dataRecord['database_user'], 0, 16);
 		}
 
+		/* prepare password for MongoDB */
+		// TODO: this still doens't work as when only the username changes we have no database_password.
+		// taking the one from oldData doesn't work as it's encrypted...shit!
+		$this->dataRecord['database_password_mongo'] = $this->dataRecord['database_user'].":mongo:".$this->dataRecord['database_password'];
+
 		$this->dataRecord['server_id'] = 0; // we need this on all servers
 
 		parent::onBeforeUpdate();
@@ -181,6 +189,9 @@
 
 		$this->dataRecord['server_id'] = 0; // we need this on all servers
 
+		/* prepare password for MongoDB */
+		$this->dataRecord['database_password_mongo'] = $this->dataRecord['database_user'].":mongo:".$this->dataRecord['database_password'];
+
 		parent::onBeforeInsert();
 	}
 

--
Gitblit v1.9.1