From bdf95505e2d148c5122ab7630649e629a2ef1fec Mon Sep 17 00:00:00 2001
From: Pascal Dreissen <pascal@dreissen.nl>
Date: Wed, 20 Jul 2016 18:42:18 -0400
Subject: [PATCH] Removed all inline javascript focus code, general function to protect all password fields including tooltip

---
 interface/web/themes/default/assets/javascripts/ispconfig.js |   15 +++++++++------
 1 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/interface/web/themes/default/assets/javascripts/ispconfig.js b/interface/web/themes/default/assets/javascripts/ispconfig.js
index dbe96d9..cfd15c8 100644
--- a/interface/web/themes/default/assets/javascripts/ispconfig.js
+++ b/interface/web/themes/default/assets/javascripts/ispconfig.js
@@ -136,6 +136,15 @@
 		});
 		$('[data-toggle="tooltip"]').tooltip({
 		});
+		// grab all password fields and set the readonly prop to prevent password managers to fill in new password
+		$('input[type="password"]').each(function() {
+			$(this).prop('readonly', true)
+			.tooltip({title: "Click to set", placement: "left"});
+		});
+		$('input[type="password"]').on('click focus', function() { 
+			$(this).prop('readonly', false);
+			$(this).tooltip('destroy');
+		});
 		
 		ISPConfig.callHook('onAfterContentLoad', {'url': url, 'data': data });
 	},
@@ -550,12 +559,6 @@
 	}
 };
 
-function removeReadOnly(password) {
-	password.removeAttribute('readonly');
-	password.removeAttribute('data-original-title');
-	password.removeAttribute('data-toggle');
-	password.removeAttribute('data-placement');
-}
 $(document).on("change", function(event) {
 	var elName = event.target.localName;
 	if ($("#pageForm .table #Filter").length > 0 && elName == 'select') {

--
Gitblit v1.9.1