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
41f6c5d2
Commit
41f6c5d2
authored
3 years ago
by
Timothee P
Browse files
Options
Downloads
Patches
Plain Diff
disable index button if shared project on login page
parent
1680906d
No related branches found
No related tags found
2 merge requests
!295
Version 3.0.0
,
!294
REDMINE_ISSUE-13086
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
src/App.vue
+3
-2
3 additions, 2 deletions
src/App.vue
src/router/index.js
+1
-5
1 addition, 5 deletions
src/router/index.js
src/store/index.js
+27
-15
27 additions, 15 deletions
src/store/index.js
src/views/registration/Login.vue
+2
-2
2 additions, 2 deletions
src/views/registration/Login.vue
with
33 additions
and
24 deletions
src/App.vue
+
3
−
2
View file @
41f6c5d2
...
@@ -11,6 +11,7 @@
...
@@ -11,6 +11,7 @@
<div
class=
"menu container"
>
<div
class=
"menu container"
>
<div
class=
"ui inverted icon menu"
>
<div
class=
"ui inverted icon menu"
>
<router-link
<router-link
:is=
"isSharedProject ? 'span' : 'router-link'"
:to=
"isSharedProject ? '' : '/'"
:to=
"isSharedProject ? '' : '/'"
:class=
"['header item',
{disable: isSharedProject}]"
:class=
"['header item',
{disable: isSharedProject}]"
>
>
...
@@ -122,7 +123,7 @@
...
@@ -122,7 +123,7 @@
</a>
</a>
<router-link
<router-link
v-else-if=
"!user && !SSO_LOGIN_URL"
v-else-if=
"!user && !SSO_LOGIN_URL"
to=
"
/connexion/
"
:
to=
"
{ name : 'login' }
"
class="item"
class="item"
>
>
Se connecter
Se connecter
...
@@ -175,7 +176,7 @@
...
@@ -175,7 +176,7 @@
</a>
</a>
<router-link
<router-link
v-else-if=
"!user && !SSO_LOGIN_URL"
v-else-if=
"!user && !SSO_LOGIN_URL"
to=
"
/connexion/
"
:
to=
"
{ name : 'login' }
"
class="item"
class="item"
>
>
Se Connecter
Se Connecter
...
...
This diff is collapsed.
Click to expand it.
src/router/index.js
+
1
−
5
View file @
41f6c5d2
...
@@ -4,10 +4,6 @@ import Projects from '../views/Projects.vue';
...
@@ -4,10 +4,6 @@ import Projects from '../views/Projects.vue';
Vue
.
use
(
VueRouter
);
Vue
.
use
(
VueRouter
);
//* store initial route before redirect to login page
//* in order to turn back to shared project afterwards (not memorized in router history at page load)
window
.
initialRoute
=
window
.
location
.
href
;
let
projectBase
=
'
projet
'
;
let
projectBase
=
'
projet
'
;
if
(
window
.
location
.
pathname
.
includes
(
'
projet-partage
'
))
{
if
(
window
.
location
.
pathname
.
includes
(
'
projet-partage
'
))
{
projectBase
=
'
projet-partage
'
;
projectBase
=
'
projet-partage
'
;
...
@@ -20,7 +16,7 @@ const routes = [
...
@@ -20,7 +16,7 @@ const routes = [
component
:
Projects
component
:
Projects
},
},
{
{
path
:
'
/connexion/
'
,
path
:
`
${
projectBase
===
'
projet
'
?
''
:
'
/
'
+
projectBase
+
'
/:slug
'
}
/connexion/
`
,
name
:
'
login
'
,
name
:
'
login
'
,
component
:
()
=>
import
(
'
../views/registration/Login.vue
'
)
component
:
()
=>
import
(
'
../views/registration/Login.vue
'
)
},
},
...
...
This diff is collapsed.
Click to expand it.
src/store/index.js
+
27
−
15
View file @
41f6c5d2
...
@@ -138,21 +138,8 @@ export default new Vuex.Store({
...
@@ -138,21 +138,8 @@ export default new Vuex.Store({
})
})
.
then
((
response
)
=>
{
.
then
((
response
)
=>
{
if
(
response
.
status
===
200
&&
response
.
data
)
{
if
(
response
.
status
===
200
&&
response
.
data
)
{
// * use stored previous route to go back after login if page not open on login at first
let
routerHistory
=
''
;
if
(
router
.
options
.
routerHistory
[
0
]
!==
undefined
)
{
routerHistory
=
router
.
options
.
routerHistory
[
0
].
name
!==
'
login
'
?
router
.
options
.
routerHistory
:
'
/
'
;
}
else
{
routerHistory
=
'
/
'
;
}
commit
(
'
SET_USER
'
,
response
.
data
.
user
);
commit
(
'
SET_USER
'
,
response
.
data
.
user
);
dispatch
(
'
REDIRECT_AFTER_LOGIN
'
);
if
(
routerHistory
===
'
/
'
&&
window
.
initialRoute
.
includes
(
'
projet-partage
'
))
{
window
.
location
.
replace
(
window
.
initialRoute
);
}
else
{
// ToDo : not working at page load, routerHistory filled afterwards, could try history.back()
router
.
push
(
routerHistory
[
routerHistory
.
length
-
1
]
||
'
/
'
);
}
dispatch
(
'
GET_USER_LEVEL_PROJECTS
'
);
dispatch
(
'
GET_USER_LEVEL_PROJECTS
'
);
dispatch
(
'
GET_USER_LEVEL_PERMISSIONS
'
);
dispatch
(
'
GET_USER_LEVEL_PERMISSIONS
'
);
return
response
.
status
;
return
response
.
status
;
...
@@ -165,6 +152,23 @@ export default new Vuex.Store({
...
@@ -165,6 +152,23 @@ export default new Vuex.Store({
}
}
},
},
REDIRECT_AFTER_LOGIN
()
{
// * use stored previous route to go back after login if page not open on login at first
let
routerHistory
=
''
;
if
(
router
.
options
.
routerHistory
[
0
]
!==
undefined
)
{
routerHistory
=
router
.
options
.
routerHistory
[
0
].
name
!==
'
login
'
?
router
.
options
.
routerHistory
:
'
/
'
;
}
else
{
routerHistory
=
'
/
'
;
}
const
slug
=
router
.
history
.
current
.
params
.
slug
;
if
(
slug
)
{
router
.
push
({
name
:
'
project_detail
'
,
params
:
{
slug
}
});
}
else
{
//* not working at page load, routerHistory filled afterwards, could try history.back()
router
.
push
(
routerHistory
[
routerHistory
.
length
-
1
]
||
'
/
'
);
}
},
USER_INFO
({
state
,
commit
})
{
USER_INFO
({
state
,
commit
})
{
if
(
!
state
.
user
)
{
if
(
!
state
.
user
)
{
axios
axios
...
@@ -178,7 +182,15 @@ export default new Vuex.Store({
...
@@ -178,7 +182,15 @@ export default new Vuex.Store({
.
catch
(()
=>
{
.
catch
(()
=>
{
//* if an url to redirect to an external authentification system is present, do not redirect to the login page
//* if an url to redirect to an external authentification system is present, do not redirect to the login page
if
(
!
state
.
configuration
.
VUE_APP_LOGIN_URL
)
{
if
(
!
state
.
configuration
.
VUE_APP_LOGIN_URL
)
{
router
.
push
({
name
:
'
login
'
});
const
url
=
window
.
location
.
href
;
console
.
log
({
url
});
console
.
log
(
url
.
includes
(
'
projet-partage
'
));
if
(
url
.
includes
(
'
projet-partage
'
))
{
const
slug
=
url
.
split
(
'
projet-partage/
'
)[
1
];
router
.
push
({
name
:
'
login
'
,
params
:
{
slug
}
});
}
else
{
router
.
push
({
name
:
'
login
'
});
}
}
}
});
});
}
}
...
...
This diff is collapsed.
Click to expand it.
src/views/registration/Login.vue
+
2
−
2
View file @
41f6c5d2
...
@@ -103,9 +103,9 @@ export default {
...
@@ -103,9 +103,9 @@ export default {
if
(
this
.
$store
.
state
.
user
)
{
if
(
this
.
$store
.
state
.
user
)
{
this
.
$store
.
commit
(
this
.
$store
.
commit
(
'
DISPLAY_MESSAGE
'
,
'
DISPLAY_MESSAGE
'
,
{
comment
:
"
Vous êtes déjà connecté, vous allez être redirigé vers la page
d'accueil.
"
}
{
comment
:
'
Vous êtes déjà connecté, vous allez être redirigé vers la page
précédente.
'
}
);
);
setTimeout
(()
=>
this
.
$
router
.
push
(
'
/
'
),
3100
);
setTimeout
(()
=>
this
.
$
store
.
dispatch
(
'
REDIRECT_AFTER_LOGIN
'
),
3100
);
}
}
},
},
methods
:
{
methods
:
{
...
...
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