diff options
author | Lunny Xiao <xiaolunwen@gmail.com> | 2021-11-24 17:49:20 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-11-24 17:49:20 +0800 |
commit | a666829a37be6f9fd98f9e7dd1767c420f7f3b32 (patch) | |
tree | 9ab1434b759a8a2cb275a83149903a823851e309 /services/auth/session.go | |
parent | 4e7ca946da2a2642a62f114825129bf5d7ed9196 (diff) | |
download | gitea-a666829a37be6f9fd98f9e7dd1767c420f7f3b32.tar.gz gitea-a666829a37be6f9fd98f9e7dd1767c420f7f3b32.zip |
Move user related model into models/user (#17781)
* Move user related model into models/user
* Fix lint for windows
* Fix windows lint
* Fix windows lint
* Move some tests in models
* Merge
Diffstat (limited to 'services/auth/session.go')
-rw-r--r-- | services/auth/session.go | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/services/auth/session.go b/services/auth/session.go index 9a6e2d95d0..256598d100 100644 --- a/services/auth/session.go +++ b/services/auth/session.go @@ -7,7 +7,7 @@ package auth import ( "net/http" - "code.gitea.io/gitea/models" + user_model "code.gitea.io/gitea/models/user" "code.gitea.io/gitea/modules/log" ) @@ -30,7 +30,7 @@ func (s *Session) Name() string { // Verify checks if there is a user uid stored in the session and returns the user // object for that uid. // Returns nil if there is no user uid stored in the session. -func (s *Session) Verify(req *http.Request, w http.ResponseWriter, store DataStore, sess SessionStore) *models.User { +func (s *Session) Verify(req *http.Request, w http.ResponseWriter, store DataStore, sess SessionStore) *user_model.User { user := SessionUser(sess) if user != nil { return user @@ -39,7 +39,7 @@ func (s *Session) Verify(req *http.Request, w http.ResponseWriter, store DataSto } // SessionUser returns the user object corresponding to the "uid" session variable. -func SessionUser(sess SessionStore) *models.User { +func SessionUser(sess SessionStore) *user_model.User { // Get user ID uid := sess.Get("uid") if uid == nil { @@ -53,9 +53,9 @@ func SessionUser(sess SessionStore) *models.User { } // Get user object - user, err := models.GetUserByID(id) + user, err := user_model.GetUserByID(id) if err != nil { - if !models.IsErrUserNotExist(err) { + if !user_model.IsErrUserNotExist(err) { log.Error("GetUserById: %v", err) } return nil |