Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
G
Géocontrib Frontend
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Redmine
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
GéoContrib
Géocontrib Frontend
Commits
93d1508f
Commit
93d1508f
authored
7 months ago
by
Timothee P
Browse files
Options
Downloads
Patches
Plain Diff
fix: return user_info to load app after user related data is fetch
parent
0fbd316a
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!822
REDMINE_ISSUE-18860 | Authentification GéoContrib via API OGS
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/main.js
+0
-3
0 additions, 3 deletions
src/main.js
src/store/index.js
+11
-6
11 additions, 6 deletions
src/store/index.js
with
11 additions
and
9 deletions
src/main.js
+
0
−
3
View file @
93d1508f
...
...
@@ -106,11 +106,8 @@ const updateOnlineStatus = () => {
const
fetchDataAndInitializeApp
=
async
()
=>
{
await
Promise
.
all
([
store
.
dispatch
(
'
GET_USER_INFO
'
),
store
.
dispatch
(
'
projects/GET_PROJECTS
'
),
store
.
dispatch
(
'
GET_STATIC_PAGES
'
),
store
.
dispatch
(
'
GET_USER_LEVEL_PROJECTS
'
),
store
.
dispatch
(
'
map/GET_AVAILABLE_LAYERS
'
),
store
.
dispatch
(
'
GET_USER_LEVEL_PERMISSIONS
'
),
store
.
dispatch
(
'
GET_LEVELS_PERMISSIONS
'
),
store
.
dispatch
(
'
GET_PROJECT_ATTRIBUTES
'
),
]);
...
...
This diff is collapsed.
Click to expand it.
src/store/index.js
+
11
−
6
View file @
93d1508f
...
...
@@ -209,14 +209,18 @@ export default new Vuex.Store({
dispatch
(
'
CONNECT_SSO_WITH_TOKEN
'
,
{
token
,
url_redirect
});
}
else
if
(
!
state
.
user
)
{
// If user infos are not set, try to fetch them
axios
.
get
(
`
${
state
.
configuration
.
VUE_APP_DJANGO_API_BASE
}
user_info/
?next=
${
encodeURIComponent
(
currentUrl
)}
`
)
return
axios
.
get
(
`
${
state
.
configuration
.
VUE_APP_DJANGO_API_BASE
}
user_info/`
)
.
then
((
response
)
=>
{
// Update the user state with received user data
if
(
response
&&
response
.
status
===
200
)
{
const
user
=
response
.
data
.
user
;
console
.
log
(
'
user
'
,
user
);
commit
(
'
SET_USER
'
,
user
);
// Fetch user related data
dispatch
(
'
GET_USER_LEVEL_PERMISSIONS
'
);
dispatch
(
'
GET_USER_LEVEL_PROJECTS
'
);
dispatch
(
'
projects/GET_PROJECTS
'
);
return
;
}
})
.
catch
((
error
)
=>
{
...
...
@@ -228,15 +232,16 @@ export default new Vuex.Store({
});
// Call the SSO login plateform with url to redirect after login
window
.
open
(
`
${
state
.
configuration
.
VUE_APP_SSO_LOGIN_URL_WITH_REDIRECT
}
/?url_redirect=
${
encodeURIComponent
(
currentUrl
)}
`
,
'
_self
'
);
}
else
if
(
response
&&
response
.
data
.
redirect
)
{
// If the backend return
a login url,
the user
i
s redirected
to connect through OGS login
window
.
location
.
href
=
response
.
data
.
login_url
;
}
else
if
(
response
&&
response
.
data
.
redirect
&&
state
.
configuration
.
VUE_APP_LOGIN_URL
)
{
// If the backend return
that
the user s
hould be
redirected
and a custom login url exists, call the SSO login plateform
window
.
location
.
href
=
`
${
state
.
configuration
.
VUE_APP_LOGIN_URL
}
/?next=
${
encodeURIComponent
(
currentUrl
)}
`
;
}
else
{
// If the user is not logged in, display an info message
commit
(
'
DISPLAY_MESSAGE
'
,
{
comment
:
`Vous n'êtes pas connecté actuellement.
Vous pouvez accéder à l'application en tant qu'utilisateur anonyme`
});
return
;
}
});
}
...
...
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