From e1ceb050e19c7574bca146a8da7047ee4ff456b5 Mon Sep 17 00:00:00 2001
From: Marius Burkard <m.burkard@pixcept.de>
Date: Sun, 10 Jul 2016 05:02:35 -0400
Subject: [PATCH] Merge branch 'stable-3.1'

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

diff --git a/interface/web/sites/database_user_edit.php b/interface/web/sites/database_user_edit.php
index 90b28ef..02ef7bf 100644
--- a/interface/web/sites/database_user_edit.php
+++ b/interface/web/sites/database_user_edit.php
@@ -50,6 +50,22 @@
 
 class page_action extends tform_actions {
 
+	function onShowNew() {
+		global $app;
+
+		// we will check only users, not admins
+		if($_SESSION['s']['user']['typ'] == 'user') {
+			if(!$app->tform->checkClientLimit('limit_database_user')) {
+				$app->error($app->tform->wordbook["limit_database_user_txt"]);
+			}
+			if(!$app->tform->checkResellerLimit('limit_database_user')) {
+				$app->error('Reseller: '.$app->tform->wordbook["limit_database_user_txt"]);
+			}
+		}
+
+		parent::onShowNew();
+	}
+
 	function onShowEnd() {
 		global $app, $conf, $interfaceConf;
 
@@ -153,10 +169,11 @@
 		/* 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();
 	}
 
@@ -190,7 +207,7 @@
 		$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'];
+//		$this->dataRecord['database_password_mongo'] = $this->dataRecord['database_user'].":mongo:".$this->dataRecord['database_password'];
 
 		parent::onBeforeInsert();
 	}

--
Gitblit v1.9.1