summaryrefslogtreecommitdiffstats
path: root/modules/auth
diff options
context:
space:
mode:
authorslene <vslene@gmail.com>2014-03-22 20:49:53 +0800
committerslene <vslene@gmail.com>2014-03-22 20:49:53 +0800
commitf9c07c4186b61a1548d9a908fe6228bd130f4f92 (patch)
tree7d10adada909ac74263f36a8276f2ece9988effb /modules/auth
parent0d1872ebe3f11c14f31f454ed8d719a22c0884d0 (diff)
downloadgitea-f9c07c4186b61a1548d9a908fe6228bd130f4f92.tar.gz
gitea-f9c07c4186b61a1548d9a908fe6228bd130f4f92.zip
update session
Diffstat (limited to 'modules/auth')
-rw-r--r--modules/auth/user.go11
1 files changed, 6 insertions, 5 deletions
diff --git a/modules/auth/user.go b/modules/auth/user.go
index f8d8f66149..cb8db1b29a 100644
--- a/modules/auth/user.go
+++ b/modules/auth/user.go
@@ -9,7 +9,8 @@ import (
"reflect"
"github.com/codegangsta/martini"
- "github.com/martini-contrib/sessions"
+
+ "github.com/gogits/session"
"github.com/gogits/binding"
@@ -19,7 +20,7 @@ import (
)
// SignedInId returns the id of signed in user.
-func SignedInId(session sessions.Session) int64 {
+func SignedInId(session session.SessionStore) int64 {
userId := session.Get("userId")
if userId == nil {
return 0
@@ -34,7 +35,7 @@ func SignedInId(session sessions.Session) int64 {
}
// SignedInName returns the name of signed in user.
-func SignedInName(session sessions.Session) string {
+func SignedInName(session session.SessionStore) string {
userName := session.Get("userName")
if userName == nil {
return ""
@@ -46,7 +47,7 @@ func SignedInName(session sessions.Session) string {
}
// SignedInUser returns the user object of signed user.
-func SignedInUser(session sessions.Session) *models.User {
+func SignedInUser(session session.SessionStore) *models.User {
id := SignedInId(session)
if id <= 0 {
return nil
@@ -61,7 +62,7 @@ func SignedInUser(session sessions.Session) *models.User {
}
// IsSignedIn check if any user has signed in.
-func IsSignedIn(session sessions.Session) bool {
+func IsSignedIn(session session.SessionStore) bool {
return SignedInId(session) > 0
}