diff options
Diffstat (limited to 'services/auth/source/db')
-rw-r--r-- | services/auth/source/db/authenticate.go | 12 | ||||
-rw-r--r-- | services/auth/source/db/source.go | 4 |
2 files changed, 8 insertions, 8 deletions
diff --git a/services/auth/source/db/authenticate.go b/services/auth/source/db/authenticate.go index af7b719a63..e0e439c2fe 100644 --- a/services/auth/source/db/authenticate.go +++ b/services/auth/source/db/authenticate.go @@ -5,19 +5,19 @@ package db import ( - "code.gitea.io/gitea/models" "code.gitea.io/gitea/models/db" + user_model "code.gitea.io/gitea/models/user" "code.gitea.io/gitea/modules/setting" ) // Authenticate authenticates the provided user against the DB -func Authenticate(user *models.User, login, password string) (*models.User, error) { +func Authenticate(user *user_model.User, login, password string) (*user_model.User, error) { if user == nil { - return nil, models.ErrUserNotExist{Name: login} + return nil, user_model.ErrUserNotExist{Name: login} } if !user.IsPasswordSet() || !user.ValidatePassword(password) { - return nil, models.ErrUserNotExist{UID: user.ID, Name: user.Name} + return nil, user_model.ErrUserNotExist{UID: user.ID, Name: user.Name} } // Update password hash if server password hash algorithm have changed @@ -25,7 +25,7 @@ func Authenticate(user *models.User, login, password string) (*models.User, erro if err := user.SetPassword(password); err != nil { return nil, err } - if err := models.UpdateUserCols(db.DefaultContext, user, "passwd", "passwd_hash_algo", "salt"); err != nil { + if err := user_model.UpdateUserCols(db.DefaultContext, user, "passwd", "passwd_hash_algo", "salt"); err != nil { return nil, err } } @@ -33,7 +33,7 @@ func Authenticate(user *models.User, login, password string) (*models.User, erro // WARN: DON'T check user.IsActive, that will be checked on reqSign so that // user could be hint to resend confirm email. if user.ProhibitLogin { - return nil, models.ErrUserProhibitLogin{ + return nil, user_model.ErrUserProhibitLogin{ UID: user.ID, Name: user.Name, } diff --git a/services/auth/source/db/source.go b/services/auth/source/db/source.go index 2fedff3a7e..5ae2107a3b 100644 --- a/services/auth/source/db/source.go +++ b/services/auth/source/db/source.go @@ -5,8 +5,8 @@ package db import ( - "code.gitea.io/gitea/models" "code.gitea.io/gitea/models/login" + user_model "code.gitea.io/gitea/models/user" ) // Source is a password authentication service @@ -24,7 +24,7 @@ func (source *Source) ToDB() ([]byte, error) { // Authenticate queries if login/password is valid against the PAM, // and create a local user if success when enabled. -func (source *Source) Authenticate(user *models.User, login, password string) (*models.User, error) { +func (source *Source) Authenticate(user *user_model.User, login, password string) (*user_model.User, error) { return Authenticate(user, login, password) } |