Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
nexpie-grafana-theme
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Registry
Registry
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kornkitt Poolsup
nexpie-grafana-theme
Commits
1e577817
Commit
1e577817
authored
Aug 07, 2017
by
Daniel Lee
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
login: regenerates session id on login
parent
f547c93a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
0 deletions
+9
-0
pkg/api/login.go
+1
-0
pkg/middleware/session.go
+8
-0
No files found.
pkg/api/login.go
View file @
1e577817
...
...
@@ -143,6 +143,7 @@ func loginUserWithUser(user *m.User, c *middleware.Context) {
c
.
SetSuperSecureCookie
(
user
.
Rands
+
user
.
Password
,
setting
.
CookieRememberName
,
user
.
Login
,
days
,
setting
.
AppSubUrl
+
"/"
)
}
c
.
Session
.
RegenerateId
(
c
)
c
.
Session
.
Set
(
middleware
.
SESS_KEY_USERID
,
user
.
Id
)
}
...
...
pkg/middleware/session.go
View file @
1e577817
...
...
@@ -103,6 +103,8 @@ type SessionStore interface {
Destory
(
*
Context
)
error
// init
Start
(
*
Context
)
error
// RegenerateId regenerates the session id
RegenerateId
(
*
Context
)
error
}
type
SessionWrapper
struct
{
...
...
@@ -116,6 +118,12 @@ func (s *SessionWrapper) Start(c *Context) error {
return
err
}
func
(
s
*
SessionWrapper
)
RegenerateId
(
c
*
Context
)
error
{
var
err
error
s
.
session
,
err
=
s
.
manager
.
RegenerateId
(
c
.
Context
)
return
err
}
func
(
s
*
SessionWrapper
)
Set
(
k
interface
{},
v
interface
{})
error
{
if
s
.
session
!=
nil
{
return
s
.
session
.
Set
(
k
,
v
)
...
...
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