Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
Metabase
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Engineering Digital Service
Metabase
Commits
8f26985f
Unverified
Commit
8f26985f
authored
5 years ago
by
Paul Rosenzweig
Committed by
GitHub
5 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Avoid race between logging out and refreshing page (#10376)
parent
88396b67
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
frontend/src/metabase/auth/auth.js
+4
-4
4 additions, 4 deletions
frontend/src/metabase/auth/auth.js
frontend/src/metabase/lib/auth.js
+2
-4
2 additions, 4 deletions
frontend/src/metabase/lib/auth.js
with
6 additions
and
8 deletions
frontend/src/metabase/auth/auth.js
+
4
−
4
View file @
8f26985f
...
...
@@ -67,7 +67,7 @@ export const loginGoogle = createThunkAction(LOGIN_GOOGLE, function(
await
dispatch
(
refreshCurrentUser
());
dispatch
(
push
(
redirectUrl
||
"
/
"
));
}
catch
(
error
)
{
clearGoogleAuthCredentials
();
await
clearGoogleAuthCredentials
();
// If we see a 428 ("Precondition Required") that means we need to show the "No Metabase account exists for this Google Account" page
if
(
error
.
status
===
428
)
{
dispatch
(
push
(
"
/auth/google_no_mb_account
"
));
...
...
@@ -81,12 +81,12 @@ export const loginGoogle = createThunkAction(LOGIN_GOOGLE, function(
// logout
export
const
LOGOUT
=
"
metabase/auth/LOGOUT
"
;
export
const
logout
=
createThunkAction
(
LOGOUT
,
function
()
{
return
function
(
dispatch
,
getState
)
{
return
async
function
(
dispatch
,
getState
)
{
// actively delete the session and remove the cookie
SessionApi
.
delete
();
await
SessionApi
.
delete
();
// clear Google auth credentials if any are present
clearGoogleAuthCredentials
();
await
clearGoogleAuthCredentials
();
MetabaseAnalytics
.
trackEvent
(
"
Auth
"
,
"
Logout
"
);
...
...
This diff is collapsed.
Click to expand it.
frontend/src/metabase/lib/auth.js
+
2
−
4
View file @
8f26985f
/*global gapi*/
/// clear out Google Auth credentials in browser if present
export
function
clearGoogleAuthCredentials
()
{
export
async
function
clearGoogleAuthCredentials
()
{
const
googleAuth
=
typeof
gapi
!==
"
undefined
"
&&
gapi
&&
gapi
.
auth2
?
gapi
.
auth2
.
getAuthInstance
()
...
...
@@ -11,9 +11,7 @@ export function clearGoogleAuthCredentials() {
}
try
{
googleAuth
.
signOut
().
then
(
function
()
{
console
.
log
(
"
Cleared Google Auth credentials.
"
);
});
await
googleAuth
.
signOut
();
}
catch
(
error
)
{
console
.
error
(
"
Problem clearing Google Auth credentials
"
,
error
);
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment