Skip to content

Commit

Permalink
dashboard: Fix historical version compatibility problem for auth chec…
Browse files Browse the repository at this point in the history
…k via localStorage (alibaba#1473)
  • Loading branch information
cdfive authored May 15, 2020
1 parent 09c6ce5 commit 905ee04
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,15 @@ angular.module('sentinelDashboardApp')
}
});
} else {
handleLogout($scope, JSON.parse($window.localStorage.getItem("session_sentinel_admin")).id)
try {
var id = JSON.parse($window.localStorage.getItem("session_sentinel_admin")).id;
handleLogout($scope, id);
} catch (e) {
// Historical version compatibility processing, fixes issue-1449
// If error happens while parsing, remove item in localStorage and redirect to login page.
$window.localStorage.removeItem("session_sentinel_admin");
$state.go('login');
}
}

function handleLogout($scope, id) {
Expand Down
Loading

0 comments on commit 905ee04

Please sign in to comment.