diff options
author | Unknwon <joe2010xtmf@163.com> | 2014-11-18 11:07:16 -0500 |
---|---|---|
committer | Unknwon <joe2010xtmf@163.com> | 2014-11-18 11:07:16 -0500 |
commit | 37d8d3afe9ec589574c0cc6380a36fa93b1be8f2 (patch) | |
tree | 30d7751228cdded099b1a0e2952d66dbe6d403b6 /modules/auth/auth.go | |
parent | db0026c5070f8e6b82170a75b5f92a54b7b96ff2 (diff) | |
download | gitea-37d8d3afe9ec589574c0cc6380a36fa93b1be8f2.tar.gz gitea-37d8d3afe9ec589574c0cc6380a36fa93b1be8f2.zip |
more APIs on #12
Diffstat (limited to 'modules/auth/auth.go')
-rw-r--r-- | modules/auth/auth.go | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/modules/auth/auth.go b/modules/auth/auth.go index da89c20c1b..302620dbc8 100644 --- a/modules/auth/auth.go +++ b/modules/auth/auth.go @@ -60,9 +60,9 @@ func SignedInId(req *http.Request, sess session.Store) int64 { } // SignedInUser returns the user object of signed user. -func SignedInUser(req *http.Request, sess session.Store) *models.User { +func SignedInUser(req *http.Request, sess session.Store) (*models.User, bool) { if !models.HasEngine { - return nil + return nil, false } uid := SignedInId(req, sess) @@ -76,9 +76,9 @@ func SignedInUser(req *http.Request, sess session.Store) *models.User { if err != models.ErrUserNotExist { log.Error(4, "GetUserByName: %v", err) } - return nil + return nil, false } - return u + return u, false } } @@ -93,23 +93,23 @@ func SignedInUser(req *http.Request, sess session.Store) *models.User { if err != models.ErrUserNotExist { log.Error(4, "GetUserByName: %v", err) } - return nil + return nil, false } if u.ValidtePassword(passwd) { - return u + return u, true } } } - return nil + return nil, false } u, err := models.GetUserById(uid) if err != nil { log.Error(4, "GetUserById: %v", err) - return nil + return nil, false } - return u + return u, false } type Form interface { |