Changeset

396:8cb21ef24e5d

mod_admin_web: Show S2S certificate validity
author Florian Zeitz <florob@babelmonkeys.de>
date Fri, 29 Jul 2011 22:26:02 +0200
parents 395:77ca0947647b
children 397:7331e2669f24
files mod_admin_web/admin_web/mod_admin_web.lua mod_admin_web/admin_web/www_files/images/secure.png mod_admin_web/admin_web/www_files/js/main.js
diffstat 3 files changed, 15 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/mod_admin_web/admin_web/mod_admin_web.lua	Tue Jul 26 13:19:09 2011 +0000
+++ b/mod_admin_web/admin_web/mod_admin_web.lua	Fri Jul 29 22:26:02 2011 +0200
@@ -10,7 +10,9 @@
 -- </session>
 
 -- <session xmlns="http://prosody.im/streams/s2s" jid="example.com">
---   <encrypted/>
+--   <encrypted>
+--     <valid/> / <invalid/>
+--   </encrypted>
 --   <compressed/>
 --   <in/> / <out/>
 -- </session>
@@ -86,7 +88,11 @@
 	local item = st.stanza("item", { id = id }):tag("session", {xmlns = xmlns_s2s_session, jid = name})
 		:tag(type):up();
 	if session.secure then
-		item:tag("encrypted"):up();
+		if session.cert_identity_status == "valid" then
+			item:tag("encrypted"):tag("valid"):up():up();
+		else
+			item:tag("encrypted"):tag("invalid"):up():up();
+		end
 	end
 	if session.compressed then
 		item:tag("compressed"):up();
Binary file mod_admin_web/admin_web/www_files/images/secure.png has changed
--- a/mod_admin_web/admin_web/www_files/js/main.js	Tue Jul 26 13:19:09 2011 +0000
+++ b/mod_admin_web/admin_web/www_files/js/main.js	Fri Jul 29 22:26:02 2011 +0200
@@ -25,15 +25,19 @@
 }
 
 function _cbNewS2S(e) {
-    var items, entry, retract, id, jid;
+    var items, entry, tmp, retract, id, jid;
     items = e.getElementsByTagName('item');
     for (i = 0; i < items.length; i++) {
         id = items[i].attributes['id'].value;
         jid = items[i].getElementsByTagName('session')[0].attributes['jid'].value;
 
         entry = $('<li id="' + id + '">' + jid + '</li>');
-        if (items[i].getElementsByTagName('encrypted')[0]) {
-            entry.append('<img src="images/encrypted.png" title="encrypted" alt=" (encrypted)" />');
+        if (tmp = items[i].getElementsByTagName('encrypted')[0]) {
+            if (tmp.getElementsByTagName('valid')[0]) {
+                entry.append('<img src="images/secure.png" title="encrypted (certificate valid)" alt=" (secure) (encrypted)" />');
+            } else {
+                entry.append('<img src="images/encrypted.png" title="encrypted (certificate invalid)" alt=" (encrypted)" />');
+            }
         }
         if (items[i].getElementsByTagName('compressed')[0]) {
             entry.append('<img src="images/compressed.png" title="compressed" alt=" (compressed)" />');