You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nifi.apache.org by sc...@apache.org on 2020/02/21 22:24:25 UTC
[nifi-registry] 03/03: NIFIREG-361 - Fixed javascript as per code
review. Tested with ldap, still logs out user as expected.
This is an automated email from the ASF dual-hosted git repository.
scottyaslan pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nifi-registry.git
commit cb5e0f0c895d34b77519112bbd3682fd3e457a4d
Author: Nathan Gough <th...@gmail.com>
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 <sc...@gmail.com>
---
.../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 29d9b54..ea2ba22 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
@@ -740,8 +740,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) {