Module: check_mk
Branch: master
Commit: 958ad48ebc1227ca384893c34bc9daf8a4d90311
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=958ad48ebc1227…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Wed Jul 27 13:47:37 2016 +0200
3724 Password input fields: Added note about plain text storing (if done so)
---
.werks/3724 | 9 +++++++++
ChangeLog | 1 +
web/htdocs/key_mgmt.py | 3 +++
web/htdocs/valuespec.py | 24 ++++++++++++++++++++++--
4 files changed, 35 insertions(+), 2 deletions(-)
diff --git a/.werks/3724 b/.werks/3724
new file mode 100644
index 0000000..f6f9590
--- /dev/null
+++ b/.werks/3724
@@ -0,0 +1,9 @@
+Title: Password input fields: Added note about plain text storing (if done so)
+Level: 1
+Component: wato
+Compatible: compat
+Version: 1.4.0i1
+Date: 1469620027
+Class: feature
+
+
diff --git a/ChangeLog b/ChangeLog
index ac16e0c..3326528 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -428,6 +428,7 @@
* 3553 SNMPv3 noAuthNoPriv: Fixed diagnostic page
* 3154 added ability to retrieve passwords for active checks from a password store
* 3667 Search expressions in host search can now be given as regexes...
+ * 3724 Password input fields: Added note about plain text storing (if done so)
* 3060 FIX: Folder properties: Fixed exception when a user has no alias set...
* 3062 FIX: Git integration: Fixed not adding files in WATO folders to git control
* 3203 FIX: Distributed WATO: Fixed exception in remote host service discovery...
diff --git a/web/htdocs/key_mgmt.py b/web/htdocs/key_mgmt.py
index e35023d..203d623 100644
--- a/web/htdocs/key_mgmt.py
+++ b/web/htdocs/key_mgmt.py
@@ -253,6 +253,7 @@ class PageEditKey(object):
title = _("Passphrase"),
help = self._passphrase_help(),
allow_empty = False,
+ is_stored_plain = False,
)),
],
optional_keys = False,
@@ -376,6 +377,7 @@ class PageUploadKey(object):
title = _("Passphrase"),
help = self._passphrase_help(),
allow_empty = False,
+ is_stored_plain = False,
)),
("key_file", CascadingDropdown(
title = _("Key"),
@@ -468,6 +470,7 @@ class PageDownloadKey(object):
Password(
title = _("Passphrase"),
allow_empty = False,
+ is_stored_plain = False,
)),
],
optional_keys = False,
diff --git a/web/htdocs/valuespec.py b/web/htdocs/valuespec.py
index 28779f6..1f9096c 100644
--- a/web/htdocs/valuespec.py
+++ b/web/htdocs/valuespec.py
@@ -3346,6 +3346,19 @@ class LDAPDistinguishedName(TextUnicode):
class Password(TextAscii):
def __init__(self, **kwargs):
+ self._is_stored_plain = kwargs.get("is_stored_plain", True)
+
+ if self._is_stored_plain:
+ plain_help = _("The password entered here is stored in plain text within
the "
+ "monitoring site. This usually needed because the
monitoring "
+ "process needs to have access to the unencrypted password
"
+ "because it needs to submit it to authenticate with
remote systems. ")
+
+ if "help" in kwargs:
+ kwargs["help"] += "<br><br>" +
plain_help
+ else:
+ kwargs["help"] = plain_help
+
TextAscii.__init__(self, attrencode = True, **kwargs)
def render_input(self, varprefix, value):
@@ -3356,6 +3369,10 @@ class Password(TextAscii):
html.write(self._label)
html.write(" ")
html.password_input(varprefix, str(value), size = self._size)
+ if self._is_stored_plain:
+ html.write("<span>%s</span>" % _("Please note that
this password is stored in plain "
+ "text."))
+
def value_to_text(self, value):
if value == None:
@@ -3365,12 +3382,12 @@ class Password(TextAscii):
-class PasswordSpec(TextAscii):
+class PasswordSpec(Password):
def __init__(self, **kwargs):
self._hidden = kwargs.get('hidden', False)
if self._hidden:
kwargs["type"] = "password"
- TextAscii.__init__(self, **kwargs)
+ Password.__init__(self, **kwargs)
def render_input(self, varprefix, value):
@@ -3381,6 +3398,9 @@ class PasswordSpec(TextAscii):
if self._hidden:
html.icon_button("#", _(u"Show/Hide password"),
"showhide",
onclick="vs_toggle_hidden(this);")
+ if self._is_stored_plain:
+ html.write("<span>%s</span>" % _("Please note that
this password is stored in plain "
+ "text."))