Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wiki-js
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
1
Issues
1
List
Board
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
wiki-js
Commits
ff5acba3
Commit
ff5acba3
authored
Feb 07, 2020
by
NGPixel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: redirect to previous path after login
parent
1fc786e2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
1 deletion
+12
-1
login.vue
client/components/login.vue
+7
-1
common.js
server/controllers/common.js
+5
-0
No files found.
client/components/login.vue
View file @
ff5acba3
...
@@ -294,7 +294,13 @@ export default {
...
@@ -294,7 +294,13 @@ export default {
this
.
loaderTitle
=
this
.
$t
(
'auth:loginSuccess'
)
this
.
loaderTitle
=
this
.
$t
(
'auth:loginSuccess'
)
Cookies
.
set
(
'jwt'
,
respObj
.
jwt
,
{
expires
:
365
}
)
Cookies
.
set
(
'jwt'
,
respObj
.
jwt
,
{
expires
:
365
}
)
_
.
delay
(()
=>
{
_
.
delay
(()
=>
{
window
.
location
.
replace
(
'/'
)
// TEMPORARY - USE RETURNURL
const
loginRedirect
=
Cookies
.
get
(
'loginRedirect'
)
if
(
loginRedirect
)
{
Cookies
.
remove
(
'loginRedirect'
)
window
.
location
.
replace
(
loginRedirect
)
}
else
{
window
.
location
.
replace
(
'/'
)
}
}
,
1000
)
}
,
1000
)
}
}
}
else
{
}
else
{
...
...
server/controllers/common.js
View file @
ff5acba3
...
@@ -245,6 +245,11 @@ router.get('/*', async (req, res, next) => {
...
@@ -245,6 +245,11 @@ router.get('/*', async (req, res, next) => {
pageArgs
.
tags
=
_
.
get
(
page
,
'tags'
,
[])
pageArgs
.
tags
=
_
.
get
(
page
,
'tags'
,
[])
if
(
!
WIKI
.
auth
.
checkAccess
(
req
.
user
,
[
'read:pages'
],
pageArgs
))
{
if
(
!
WIKI
.
auth
.
checkAccess
(
req
.
user
,
[
'read:pages'
],
pageArgs
))
{
if
(
req
.
user
.
id
===
2
)
{
res
.
cookie
(
'loginRedirect'
,
req
.
path
,
{
maxAge
:
15
*
60
*
1000
})
}
if
(
pageArgs
.
path
===
'home'
&&
req
.
user
.
id
===
2
)
{
if
(
pageArgs
.
path
===
'home'
&&
req
.
user
.
id
===
2
)
{
return
res
.
redirect
(
'/login'
)
return
res
.
redirect
(
'/login'
)
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment