This is an automated email from the ASF dual-hosted git repository. aboda pushed a commit to branch NIFIREG-371-RC1 in repository https://gitbox.apache.org/repos/asf/nifi-registry.git
commit 1da08b1bf5e0aab1c9da902ba41563b1bc5da9bf Author: Nathan Gough <[email protected]> AuthorDate: Fri Feb 21 14:24:05 2020 -0500 NIFIREG-361 - Fixed javascript as per code review. Tested with ldap, still logs out user as expected. This closes #259 Signed-off-by: Scott Aslan <[email protected]> --- .../src/main/webapp/nf-registry.js | 22 ++++++++++++++++------ .../src/main/webapp/services/nf-registry.api.js | 2 -- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/nifi-registry-core/nifi-registry-web-ui/src/main/webapp/nf-registry.js b/nifi-registry-core/nifi-registry-web-ui/src/main/webapp/nf-registry.js index 371b2de..79e97a8 100644 --- a/nifi-registry-core/nifi-registry-web-ui/src/main/webapp/nf-registry.js +++ b/nifi-registry-core/nifi-registry-web-ui/src/main/webapp/nf-registry.js @@ -71,12 +71,22 @@ NfRegistry.prototype = { * Invalidate old tokens and route to login page */ logout: function () { - this.nfRegistryApi.deleteToLogout().subscribe(function () { - - }); - delete this.nfRegistryService.currentUser.identity; - delete this.nfRegistryService.currentUser.anonymous; - this.router.navigateByUrl('login'); + var self = this; + self.nfRegistryApi.deleteToLogout().subscribe( + function () { + // next call + }, + function () { + // error callback + }, + function () { + // complete callback... clean up and navigate on complete only + self.nfStorage.removeItem('jwt'); + delete self.nfRegistryService.currentUser.identity; + delete self.nfRegistryService.currentUser.anonymous; + self.router.navigateByUrl('login'); + } + ); }, /** diff --git a/nifi-registry-core/nifi-registry-web-ui/src/main/webapp/services/nf-registry.api.js b/nifi-registry-core/nifi-registry-web-ui/src/main/webapp/services/nf-registry.api.js index a060630..041a0a1 100644 --- a/nifi-registry-core/nifi-registry-web-ui/src/main/webapp/services/nf-registry.api.js +++ b/nifi-registry-core/nifi-registry-web-ui/src/main/webapp/services/nf-registry.api.js @@ -717,8 +717,6 @@ NfRegistryApi.prototype = { return this.http.delete('../nifi-registry-api/access/logout', options).pipe( map(function (response) { - // remove the token from local storage - self.nfStorage.removeItem('jwt'); return response; }), catchError(function (error) {
