Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
go-sso
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
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
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
id
go-sso
Commits
198f7394
Commit
198f7394
authored
6 years ago
by
ale
Browse files
Options
Downloads
Patches
Plain Diff
Do not ask for explicit confirmation on logout
Fixes issue
#8
.
parent
07c9a990
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
server/bindata.go
+1
-22
1 addition, 22 deletions
server/bindata.go
server/http.go
+22
-25
22 additions, 25 deletions
server/http.go
server/templates/logout.html
+0
-21
0 additions, 21 deletions
server/templates/logout.html
with
23 additions
and
68 deletions
server/bindata.go
+
1
−
22
View file @
198f7394
...
...
@@ -1247,7 +1247,6 @@ func templatesLogin_u2fHtml() (*asset, error) {
var
_templatesLogoutHtml
=
[]
byte
(
`{{template "header" .}}
{{if .IsPOST}}
<div class="form-signin">
<h1 class="form-signin-heading>">Sign Out</h1>
...
...
@@ -1287,26 +1286,6 @@ var _templatesLogoutHtml = []byte(`{{template "header" .}}
<div id="services" data-services="{{.ServicesJSON}}"></div>
</div>
{{else}}
<form class="form-signin" action="{{.URLPrefix}}/logout" method="post">
{{.CSRFField}}
<h1 class="form-signin-heading">Sign Out</h1>
<p>
You are about to sign out from the following services:
</p>
<ul>
{{range .Services}}
<li>{{.Name}}</li>
{{end}}
</ul>
<button type="submit" class="btn btn-lg btn-primary btn-block">Logout</button>
</form>
{{end}}
{{template "footer" .}}
`
)
...
...
@@ -1321,7 +1300,7 @@ func templatesLogoutHtml() (*asset, error) {
return
nil
,
err
}
info
:=
bindataFileInfo
{
name
:
"templates/logout.html"
,
size
:
1
524
,
mode
:
os
.
FileMode
(
420
),
modTime
:
time
.
Unix
(
154
1234913
,
0
)}
info
:=
bindataFileInfo
{
name
:
"templates/logout.html"
,
size
:
1
063
,
mode
:
os
.
FileMode
(
420
),
modTime
:
time
.
Unix
(
154
8600535
,
0
)}
a
:=
&
asset
{
bytes
:
bytes
,
info
:
info
}
return
a
,
nil
}
...
...
This diff is collapsed.
Click to expand it.
server/http.go
+
22
−
25
View file @
198f7394
...
...
@@ -299,37 +299,34 @@ func (h *Server) handleLogout(w http.ResponseWriter, req *http.Request, session
})
}
svcJSON
,
_
:=
json
.
Marshal
(
svcs
)
// nolint
data
:=
map
[
string
]
interface
{}{
"CSRFField"
:
csrf
.
TemplateField
(
req
),
"URLPrefix"
:
h
.
urlPrefix
,
"Services"
:
svcs
,
"IsPOST"
:
false
,
"CSRFField"
:
csrf
.
TemplateField
(
req
),
"URLPrefix"
:
h
.
urlPrefix
,
"Services"
:
svcs
,
"IncludeLogoutScripts"
:
true
,
"ServicesJSON"
:
string
(
svcJSON
),
}
if
req
.
Method
==
"POST"
{
data
[
"IsPOST"
]
=
true
data
[
"IncludeLogoutScripts"
]
=
true
svcJSON
,
_
:=
json
.
Marshal
(
svcs
)
// nolint
data
[
"ServicesJSON"
]
=
string
(
svcJSON
)
// Clear the local session. Ignore errors.
httpSession
,
_
:=
h
.
authSessionStore
.
Get
(
req
,
authSessionKey
)
// nolint
httpSession
.
Options
.
MaxAge
=
-
1
httpSession
.
Save
(
req
,
w
)
// nolint
// Close the keystore.
if
h
.
keystore
!=
nil
{
var
shard
string
if
session
.
UserInfo
!=
nil
{
shard
=
session
.
UserInfo
.
Shard
}
if
err
:=
h
.
keystore
.
Close
(
req
.
Context
(),
shard
,
session
.
Username
);
err
!=
nil
{
log
.
Printf
(
"failed to wipe keystore for user %s: %v"
,
session
.
Username
,
err
)
}
// Clear the local session. Ignore errors.
httpSession
,
_
:=
h
.
authSessionStore
.
Get
(
req
,
authSessionKey
)
// nolint
delete
(
httpSession
.
Values
,
"data"
)
httpSession
.
Options
.
MaxAge
=
-
1
httpSession
.
Save
(
req
,
w
)
// nolint
// Close the keystore.
if
h
.
keystore
!=
nil
{
var
shard
string
if
session
.
UserInfo
!=
nil
{
shard
=
session
.
UserInfo
.
Shard
}
if
err
:=
h
.
keystore
.
Close
(
req
.
Context
(),
shard
,
session
.
Username
);
err
!=
nil
{
log
.
Printf
(
"failed to wipe keystore for user %s: %v"
,
session
.
Username
,
err
)
}
w
.
Header
()
.
Set
(
"Content-Security-Policy"
,
logoutContentSecurityPolicy
)
}
w
.
Header
()
.
Set
(
"Content-Security-Policy"
,
logoutContentSecurityPolicy
)
h
.
tpl
.
ExecuteTemplate
(
w
,
"logout.html"
,
data
)
// nolint
}
...
...
This diff is collapsed.
Click to expand it.
server/templates/logout.html
+
0
−
21
View file @
198f7394
{{template "header" .}}
{{if .IsPOST}}
<div
class=
"form-signin"
>
<h1
class=
"form-signin-heading>"
>
Sign Out
</h1>
...
...
@@ -40,25 +39,5 @@
<div
id=
"services"
data-services=
"{{.ServicesJSON}}"
></div>
</div>
{{else}}
<form
class=
"form-signin"
action=
"{{.URLPrefix}}/logout"
method=
"post"
>
{{.CSRFField}}
<h1
class=
"form-signin-heading"
>
Sign Out
</h1>
<p>
You are about to sign out from the following services:
</p>
<ul>
{{range .Services}}
<li>
{{.Name}}
</li>
{{end}}
</ul>
<button
type=
"submit"
class=
"btn btn-lg btn-primary btn-block"
>
Logout
</button>
</form>
{{end}}
{{template "footer" .}}
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