From ec22504d6e4863dfdcc07e4b9ec23876a50a2905 Mon Sep 17 00:00:00 2001 From: Matt Gilman Date: Thu, 27 Oct 2022 13:29:21 -0400 Subject: [PATCH] NIFI-10709 Showed log in link on logout complete page - Fixing issue remove token when logging out from the canvas. This closes #6592 Signed-off-by: David Handermann --- .../src/main/webapp/WEB-INF/pages/logout.jsp | 17 +++++++------ .../nf-ng-canvas-header-controller.js | 16 ++++++------ .../src/main/webapp/js/nf/logout/nf-logout.js | 25 ++++++++++++++----- 3 files changed, 37 insertions(+), 21 deletions(-) diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/WEB-INF/pages/logout.jsp b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/WEB-INF/pages/logout.jsp index 3bb31f5624..26a383371a 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/WEB-INF/pages/logout.jsp +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/WEB-INF/pages/logout.jsp @@ -40,13 +40,16 @@ ${nf.logout.script.tags} - +
diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/controllers/nf-ng-canvas-header-controller.js b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/controllers/nf-ng-canvas-header-controller.js index c271348950..f1faf4656b 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/controllers/nf-ng-canvas-header-controller.js +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/controllers/nf-ng-canvas-header-controller.js @@ -21,27 +21,27 @@ if (typeof define === 'function' && define.amd) { define(['jquery', 'nf.Common', - 'nf.Storage', + 'nf.AuthorizationStorage', 'nf.Shell', 'nf.ErrorHandler'], - function ($, nfCommon, nfStorage, nfShell, nfErrorHandler) { - return (nf.ng.Canvas.HeaderCtrl = factory($, nfCommon, nfStorage, nfShell, nfErrorHandler)); + function ($, nfCommon, nfAuthorizationStorage, nfShell, nfErrorHandler) { + return (nf.ng.Canvas.HeaderCtrl = factory($, nfCommon, nfAuthorizationStorage, nfShell, nfErrorHandler)); }); } else if (typeof exports === 'object' && typeof module === 'object') { module.exports = (nf.ng.Canvas.HeaderCtrl = factory(require('jquery'), require('nf.Common'), - require('nf.Storage'), + require('nf.AuthorizationStorage'), require('nf.Shell'), require('nf.ErrorHandler'))); } else { nf.ng.Canvas.HeaderCtrl = factory(root.$, root.nf.Common, - root.nf.Storage, + root.nf.AuthorizationStorage, root.nf.Shell, root.nf.ErrorHandler); } -}(this, function ($, nfCommon, nfStorage, nfShell, nfErrorHandler) { +}(this, function ($, nfCommon, nfAuthorizationStorage, nfShell, nfErrorHandler) { 'use strict'; return function (serviceProvider, toolboxCtrl, globalMenuCtrl, flowStatusCtrl) { @@ -121,7 +121,7 @@ type: 'DELETE', url: '../nifi-api/access/logout', }).done(function () { - nfStorage.removeItem("jwt"); + nfAuthorizationStorage.removeToken(); window.location = '../nifi/logout'; }).fail(nfErrorHandler.handleAjaxError); } @@ -157,4 +157,4 @@ headerCtrl.register(); return headerCtrl; }; -})); \ No newline at end of file +})); diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/logout/nf-logout.js b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/logout/nf-logout.js index d353c26639..debc169bc2 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/logout/nf-logout.js +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/logout/nf-logout.js @@ -33,12 +33,25 @@ 'use strict'; $(document).ready(function () { - $('#user-home').on('mouseenter', function () { - $(this).addClass('link-over'); - }).on('mouseleave', function () { - $(this).removeClass('link-over'); - }).on('click', function () { + // handle login + $('#user-login').on('click', function () { + window.location = '../nifi/login'; + }); + + // handle home + $('#user-home').on('click', function () { window.location = '../nifi/'; }); + + // load whether log in should be supported + $.ajax({ + type: 'GET', + url: '../nifi-api/access/config', + dataType: 'json' + }).done(function (response) { + if (response.config.supportsLogin) { + $('#user-login-container').show(); + } + }); }); -})); \ No newline at end of file +}));