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
ad438309
Unverified
Commit
ad438309
authored
8 years ago
by
Tom Robinson
Browse files
Options
Downloads
Patches
Plain Diff
Namespace/export auth action types, use in user reducer
parent
e02e1c18
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
frontend/src/metabase/auth/auth.js
+13
-8
13 additions, 8 deletions
frontend/src/metabase/auth/auth.js
frontend/src/metabase/redux/user.js
+2
-1
2 additions, 1 deletion
frontend/src/metabase/redux/user.js
with
15 additions
and
9 deletions
frontend/src/metabase/auth/auth.js
+
13
−
8
View file @
ad438309
...
...
@@ -15,7 +15,8 @@ import { SessionApi } from "metabase/services";
// login
export
const
login
=
createThunkAction
(
"
AUTH_LOGIN
"
,
function
(
credentials
,
redirectUrl
)
{
export
const
LOGIN
=
"
metabase/auth/LOGIN
"
;
export
const
login
=
createThunkAction
(
LOGIN
,
function
(
credentials
,
redirectUrl
)
{
return
async
function
(
dispatch
,
getState
)
{
if
(
!
MetabaseUtils
.
validEmail
(
credentials
.
email
))
{
...
...
@@ -41,7 +42,8 @@ export const login = createThunkAction("AUTH_LOGIN", function(credentials, redir
// login Google
export
const
loginGoogle
=
createThunkAction
(
"
AUTH_LOGIN_GOOGLE
"
,
function
(
googleUser
,
redirectUrl
)
{
export
const
LOGIN_GOOGLE
=
"
metabase/auth/LOGIN_GOOGLE
"
;
export
const
loginGoogle
=
createThunkAction
(
LOGIN_GOOGLE
,
function
(
googleUser
,
redirectUrl
)
{
return
async
function
(
dispatch
,
getState
)
{
try
{
let
newSession
=
await
SessionApi
.
createWithGoogleAuth
({
...
...
@@ -70,7 +72,8 @@ export const loginGoogle = createThunkAction("AUTH_LOGIN_GOOGLE", function(googl
});
// logout
export
const
logout
=
createThunkAction
(
"
AUTH_LOGOUT
"
,
function
()
{
export
const
LOGOUT
=
"
metabase/auth/LOGOUT
"
;
export
const
logout
=
createThunkAction
(
LOGOUT
,
function
()
{
return
function
(
dispatch
,
getState
)
{
// TODO: as part of a logout we want to clear out any saved state that we have about anything
...
...
@@ -86,7 +89,8 @@ export const logout = createThunkAction("AUTH_LOGOUT", function() {
});
// passwordReset
export
const
passwordReset
=
createThunkAction
(
"
AUTH_PASSWORD_RESET
"
,
function
(
token
,
credentials
)
{
export
const
PASSWORD_RESET
=
"
metabase/auth/PASSWORD_RESET
"
export
const
passwordReset
=
createThunkAction
(
PASSWORD_RESET
,
function
(
token
,
credentials
)
{
return
async
function
(
dispatch
,
getState
)
{
if
(
credentials
.
password
!==
credentials
.
password2
)
{
...
...
@@ -123,16 +127,17 @@ export const passwordReset = createThunkAction("AUTH_PASSWORD_RESET", function(t
// reducers
const
loginError
=
handleActions
({
[
"
AUTH_
LOGIN
"
]:
{
next
:
(
state
,
{
payload
})
=>
payload
?
payload
:
null
},
[
"
AUTH_
LOGIN_GOOGLE
"
]:
{
next
:
(
state
,
{
payload
})
=>
payload
?
payload
:
null
}
[
LOGIN
]:
{
next
:
(
state
,
{
payload
})
=>
payload
?
payload
:
null
},
[
LOGIN_GOOGLE
]:
{
next
:
(
state
,
{
payload
})
=>
payload
?
payload
:
null
}
},
null
);
const
resetSuccess
=
handleActions
({
[
"
AUTH_
PASSWORD_RESET
"
]:
{
next
:
(
state
,
{
payload
})
=>
payload
.
success
}
[
PASSWORD_RESET
]:
{
next
:
(
state
,
{
payload
})
=>
payload
.
success
}
},
false
);
const
resetError
=
handleActions
({
[
"
AUTH_
PASSWORD_RESET
"
]:
{
next
:
(
state
,
{
payload
})
=>
payload
.
error
}
[
PASSWORD_RESET
]:
{
next
:
(
state
,
{
payload
})
=>
payload
.
error
}
},
null
);
export
default
combineReducers
({
...
...
This diff is collapsed.
Click to expand it.
frontend/src/metabase/redux/user.js
+
2
−
1
View file @
ad438309
...
...
@@ -3,6 +3,7 @@
import
{
createAction
,
handleActions
,
createThunkAction
}
from
"
metabase/lib/redux
"
;
import
{
CLOSE_QB_NEWB_MODAL
}
from
"
metabase/query_builder/actions
"
;
import
{
LOGOUT
}
from
"
metabase/auth/auth
"
;
import
{
UserApi
}
from
"
metabase/services
"
;
...
...
@@ -28,8 +29,8 @@ export const CLEAR_CURRENT_USER = "metabase/user/CLEAR_CURRENT_USER"
export
const
clearCurrentUser
=
createAction
(
CLEAR_CURRENT_USER
)
export
const
currentUser
=
handleActions
({
[
LOGOUT
]:
{
next
:
(
state
,
{
payload
})
=>
null
},
[
CLEAR_CURRENT_USER
]:
{
next
:
(
state
,
payload
)
=>
null
},
[
REFRESH_CURRENT_USER
]:
{
next
:
(
state
,
{
payload
})
=>
payload
},
[
CLEAR_CURRENT_USER
]:
{
next
:
(
state
,
{
payload
})
=>
null
},
[
CLOSE_QB_NEWB_MODAL
]:
{
next
:
(
state
,
{
payload
})
=>
({
...
state
,
is_qbnewb
:
false
})
},
},
null
);
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