Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Nicolas PERNOUD
Vestibule
Commits
c0cd0c7c
Commit
c0cd0c7c
authored
Jun 23, 2021
by
Nicolas Pernoud
Browse files
fix: do not redirect on favicon and keep query in redirect after login
parent
08cd35cc
Pipeline
#14669
passed with stages
in 2 minutes and 41 seconds
Changes
2
Pipelines
1
Show whitespace changes
Inline
Side-by-side
pkg/auth/auth.go
View file @
c0cd0c7c
...
@@ -80,8 +80,8 @@ func ValidateAuthMiddleware(next http.Handler, allowedRoles []string, checkXSRF
...
@@ -80,8 +80,8 @@ func ValidateAuthMiddleware(next http.Handler, allowedRoles []string, checkXSRF
redirectTo
+=
":"
+
port
redirectTo
+=
":"
+
port
}
}
// Write the requested url in a cookie
// Write the requested url in a cookie
if
r
.
Host
!=
redirectTo
{
if
r
.
Host
!=
redirectTo
&&
r
.
URL
.
Path
!=
"/favicon.ico"
{
cookie
:=
http
.
Cookie
{
Name
:
"redirectAfterLogin"
,
Domain
:
hostname
,
Value
:
r
.
Host
+
r
.
URL
.
Path
,
MaxAge
:
30
,
Secure
:
true
,
HttpOnly
:
false
,
SameSite
:
http
.
SameSiteLaxMode
}
cookie
:=
http
.
Cookie
{
Name
:
"redirectAfterLogin"
,
Path
:
"/"
,
Domain
:
hostname
,
Value
:
r
.
Host
+
r
.
URL
.
Path
+
"?"
+
r
.
URL
.
RawQuery
,
MaxAge
:
30
,
Secure
:
true
,
HttpOnly
:
false
,
SameSite
:
http
.
SameSiteLaxMode
}
http
.
SetCookie
(
w
,
&
cookie
)
http
.
SetCookie
(
w
,
&
cookie
)
}
}
w
.
Header
()
.
Set
(
"Content-Type"
,
"text/html"
)
w
.
Header
()
.
Set
(
"Content-Type"
,
"text/html"
)
...
...
web/services/auth/auth.js
View file @
c0cd0c7c
...
@@ -20,7 +20,7 @@ export async function GetUser() {
...
@@ -20,7 +20,7 @@ export async function GetUser() {
const
redirectAfterLogin
=
document
.
cookie
const
redirectAfterLogin
=
document
.
cookie
.
split
(
"
;
"
)
.
split
(
"
;
"
)
.
find
((
row
)
=>
row
.
startsWith
(
"
redirectAfterLogin=
"
))
.
find
((
row
)
=>
row
.
startsWith
(
"
redirectAfterLogin=
"
))
.
split
(
"
=
"
)[
1
];
.
split
(
/=
(
.+
)
/
)[
1
];
if
(
redirectAfterLogin
!=
""
&&
redirectAfterLogin
!=
null
)
{
if
(
redirectAfterLogin
!=
""
&&
redirectAfterLogin
!=
null
)
{
window
.
location
.
replace
(
"
https://
"
+
redirectAfterLogin
);
window
.
location
.
replace
(
"
https://
"
+
redirectAfterLogin
);
...
...
Write
Preview
Supports
Markdown
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