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 <exceptionfactory@apache.org>
This commit is contained in:
Matt Gilman 2022-10-27 13:29:21 -04:00 committed by exceptionfactory
parent c40639a51f
commit ec22504d6e
No known key found for this signature in database
GPG Key ID: 29B6A52D2AAE8DBA
3 changed files with 37 additions and 21 deletions

View File

@ -40,13 +40,16 @@
${nf.logout.script.tags}
</head>
<body class="logout-body">
<div id="logout-user-links-container">
<ul id="logout-user-links" class="links">
<li>
<span id="user-home" class="link">home</span>
</li>
</ul>
</div>
<div id="logout-user-links-container">
<ul id="logout-user-links" class="links">
<li id="user-login-container" style="display: none;">
<span id="user-login" class="link">log in</span>
</li>
<li>
<span id="user-home" class="link">home</span>
</li>
</ul>
</div>
<div id="logout-contents-container">
<jsp:include page="/WEB-INF/partials/logout/logout-message.jsp"/>
</div>

View File

@ -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;
};
}));
}));

View File

@ -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();
}
});
});
}));
}));