Module: check_mk
Branch: master
Commit: 96b56b6ace8ae2d1cdb7737060003e5b0546bb6f
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=96b56b6ace8ae2…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Wed Jul 27 13:23:24 2016 +0200
Fixed password deletion and improved confirm message
---
web/htdocs/wato.py | 26 ++++++++++++++++----------
1 file changed, 16 insertions(+), 10 deletions(-)
diff --git a/web/htdocs/wato.py b/web/htdocs/wato.py
index c608063..c469f7c 100644
--- a/web/htdocs/wato.py
+++ b/web/htdocs/wato.py
@@ -15243,20 +15243,26 @@ class ModePasswords(WatoMode, PasswordStore):
if not html.transaction_valid():
return
- if action == "delete":
- if wato_confirm(_("Do you really want to delete this password?")):
- html.check_transaction() # invalidate transid
+ confirm = wato_confirm(_("Confirm deletion of password"),
+ _("The password may be used in checks. If you delete the password, the "
+ "checks won't be able to authenticate with this password anymore."
+ "<br><br>Do you really want to delete this password?"))
+ if confirm == False:
+ return False
+
+ elif confirm:
+ html.check_transaction() # invalidate transid
- passwords = self._load_for_modification()
+ passwords = self._load_for_modification()
- ident = html.var("_delete")
- if ident not in passwords:
- raise MKUserError("ident", _("This password does not exist."))
+ ident = html.var("_delete")
+ if ident not in passwords:
+ raise MKUserError("ident", _("This password does not exist."))
- del passwords[ident]
- self._save(passwords)
+ del passwords[ident]
+ self._save(passwords)
- return None, _("The password has been deleted.")
+ return None, _("The password has been deleted.")
def page(self):