Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
A
admin-fe
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository 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
Pleroma
admin-fe
Commits
ed442724
Unverified
Commit
ed442724
authored
6 years ago
by
花裤衩
Committed by
GitHub
6 years ago
Browse files
Options
Downloads
Patches
Plain Diff
feature: add a redirect url when not logged in (#1046)
Detail see #438
parent
9c5352ec
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
src/permission.js
+1
-1
1 addition, 1 deletion
src/permission.js
src/views/login/index.vue
+12
-2
12 additions, 2 deletions
src/views/login/index.vue
with
13 additions
and
3 deletions
src/permission.js
+
1
−
1
View file @
ed442724
...
...
@@ -52,7 +52,7 @@ router.beforeEach((to, from, next) => {
if
(
whiteList
.
indexOf
(
to
.
path
)
!==
-
1
)
{
// 在免登录白名单,直接进入
next
()
}
else
{
next
(
'
/login
'
)
// 否则全部重定向到登录页
next
(
`
/login
?redirect=
${
to
.
path
}
`
)
// 否则全部重定向到登录页
NProgress
.
done
()
// if current page is login will not trigger afterEach hook, so manually handle it
}
}
...
...
This diff is collapsed.
Click to expand it.
src/views/login/index.vue
+
12
−
2
View file @
ed442724
...
...
@@ -96,9 +96,19 @@ export default {
},
passwordType
:
'
password
'
,
loading
:
false
,
showDialog
:
false
showDialog
:
false
,
redirect
:
undefined
}
},
watch
:
{
$route
:
{
handler
:
function
(
route
)
{
this
.
redirect
=
route
.
query
&&
route
.
query
.
redirect
},
immediate
:
true
}
},
created
()
{
// window.addEventListener('hashchange', this.afterQRScan)
},
...
...
@@ -119,7 +129,7 @@ export default {
this
.
loading
=
true
this
.
$store
.
dispatch
(
'
LoginByUsername
'
,
this
.
loginForm
).
then
(()
=>
{
this
.
loading
=
false
this
.
$router
.
push
({
path
:
'
/
'
})
this
.
$router
.
push
({
path
:
this
.
redirect
||
'
/
'
})
}).
catch
(()
=>
{
this
.
loading
=
false
})
...
...
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