mirror of
https://github.com/apache/superset.git
synced 2026-05-07 08:54:23 +00:00
fix(logout): clicking logout displays an error notification "invalid username or password" (#36490)
This commit is contained in:
@@ -372,9 +372,11 @@ test('Logs out and clears local storage item redux', async () => {
|
||||
useTheme: true,
|
||||
});
|
||||
|
||||
// Set an item in local storage to test if it gets cleared
|
||||
// Set items in local and session storage to test if they get cleared
|
||||
localStorage.setItem('redux', JSON.stringify({ test: 'test' }));
|
||||
sessionStorage.setItem('login_attempted', 'true');
|
||||
expect(localStorage.getItem('redux')).not.toBeNull();
|
||||
expect(sessionStorage.getItem('login_attempted')).not.toBeNull();
|
||||
|
||||
userEvent.hover(await screen.findByText(/Settings/i));
|
||||
|
||||
@@ -384,8 +386,9 @@ test('Logs out and clears local storage item redux', async () => {
|
||||
userEvent.click(logoutButton);
|
||||
});
|
||||
|
||||
// Wait for local storage to be cleared
|
||||
// Wait for local and session storage to be cleared
|
||||
await waitFor(() => {
|
||||
expect(localStorage.getItem('redux')).toBeNull();
|
||||
expect(sessionStorage.getItem('login_attempted')).toBeNull();
|
||||
});
|
||||
});
|
||||
|
||||
@@ -342,7 +342,12 @@ const RightMenu = ({
|
||||
const handleDatabaseAdd = () => setQuery({ databaseAdded: true });
|
||||
|
||||
const handleLogout = () => {
|
||||
localStorage.removeItem('redux');
|
||||
try {
|
||||
window.localStorage.removeItem('redux');
|
||||
window.sessionStorage.removeItem('login_attempted');
|
||||
} catch (error) {
|
||||
console.warn('Failed to clear storage on logout:', error);
|
||||
}
|
||||
};
|
||||
|
||||
// Use the theme menu hook
|
||||
|
||||
Reference in New Issue
Block a user