[Libreoffice-commits] online.git: loleaflet/admin

Michael Meeks (via logerrit) logerrit at kemper.freedesktop.org
Mon May 4 15:56:48 UTC 2020


 loleaflet/admin/src/AdminSocketOverview.js |   11 +++++++++++
 1 file changed, 11 insertions(+)

New commits:
commit 92879102231c7a511a1fe667333592cd33d38374
Author:     Michael Meeks <michael.meeks at collabora.com>
AuthorDate: Mon May 4 14:44:04 2020 +0100
Commit:     Michael Meeks <michael.meeks at collabora.com>
CommitDate: Mon May 4 17:56:30 2020 +0200

    admin: Chrome refuses to override jwt cookies over http.
    
    So alert the user with a helpful dialog when auth. fails.
    
    Perhaps we could avoid the cookie and substitute and send the
    auth token inside the HTML itself in future.
    
    Change-Id: I1860e92e3a365bffb4cd6ab938dc3ab9cf47e5f8
    Reviewed-on: https://gerrit.libreoffice.org/c/online/+/93424
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
    Reviewed-by: Michael Meeks <michael.meeks at collabora.com>

diff --git a/loleaflet/admin/src/AdminSocketOverview.js b/loleaflet/admin/src/AdminSocketOverview.js
index 3973a1dde..c3b488010 100644
--- a/loleaflet/admin/src/AdminSocketOverview.js
+++ b/loleaflet/admin/src/AdminSocketOverview.js
@@ -393,6 +393,17 @@ var AdminSocketOverview = AdminSocketBase.extend({
 			var $mod = $(document.getElementById('mod' + sPid));
 			$mod.text(value);
 		}
+		else if (e.data == 'InvalidAuthToken' || e.data == 'NotAuthenticated') {
+			var msg;
+			if (window.location.protocol === 'http:')
+			{
+				// Browsers refuse to overwrite the jwt cookie in this case.
+				msg =  _('Failed to set jwt authentication cookie over insecure connection');
+			}
+			else
+				msg =  _('Failed to authenticate this session over');
+			vex.dialog.alert({ message: msg });
+		}
 	},
 
 	onSocketClose: function() {


More information about the Libreoffice-commits mailing list