aboutsummaryrefslogtreecommitdiff
path: root/internal/db/login_source.go
diff options
context:
space:
mode:
authorᴜɴᴋɴᴡᴏɴ <u@gogs.io>2020-03-11 00:30:51 +0800
committerGitHub <noreply@github.com>2020-03-11 00:30:51 +0800
commit047bf949089c49efa8840aaae533444e86fdbc24 (patch)
tree6f39531e12275b7665bb40e04c7618c2e4775609 /internal/db/login_source.go
parent880d0ec19f488001a90b3e370a992eaabac89e70 (diff)
ci: enable go vet check (#5981)
* ci: enable go vet check * Improve .travis.yml
Diffstat (limited to 'internal/db/login_source.go')
-rw-r--r--internal/db/login_source.go10
1 files changed, 5 insertions, 5 deletions
diff --git a/internal/db/login_source.go b/internal/db/login_source.go
index cb261f32..ee59cdbd 100644
--- a/internal/db/login_source.go
+++ b/internal/db/login_source.go
@@ -695,7 +695,7 @@ func LoginViaSMTP(user *User, login, password string, sourceID int64, cfg *SMTPC
tperr, ok := err.(*textproto.Error)
if (ok && tperr.Code == 535) ||
strings.Contains(err.Error(), "Username and Password not accepted") {
- return nil, errors.UserNotExist{0, login}
+ return nil, errors.UserNotExist{Name: login}
}
return nil, err
}
@@ -735,7 +735,7 @@ func LoginViaSMTP(user *User, login, password string, sourceID int64, cfg *SMTPC
func LoginViaPAM(user *User, login, password string, sourceID int64, cfg *PAMConfig, autoRegister bool) (*User, error) {
if err := pam.PAMAuth(cfg.ServiceName, login, password); err != nil {
if strings.Contains(err.Error(), "Authentication failure") {
- return nil, errors.UserNotExist{0, login}
+ return nil, errors.UserNotExist{Name: login}
}
return nil, err
}
@@ -768,7 +768,7 @@ func LoginViaGitHub(user *User, login, password string, sourceID int64, cfg *Git
fullname, email, url, location, err := github.Authenticate(cfg.APIEndpoint, login, password)
if err != nil {
if strings.Contains(err.Error(), "401") {
- return nil, errors.UserNotExist{0, login}
+ return nil, errors.UserNotExist{Name: login}
}
return nil, err
}
@@ -840,7 +840,7 @@ func UserLogin(username, password string, loginSourceID int64) (*User, error) {
return user, nil
}
- return nil, errors.UserNotExist{user.ID, user.Name}
+ return nil, errors.UserNotExist{UserID: user.ID, Name: user.Name}
}
// Remote login to the login source the user is associated with
@@ -854,7 +854,7 @@ func UserLogin(username, password string, loginSourceID int64) (*User, error) {
// Non-local login source is always greater than 0
if loginSourceID <= 0 {
- return nil, errors.UserNotExist{-1, username}
+ return nil, errors.UserNotExist{UserID: -1, Name: username}
}
source, err := GetLoginSourceByID(loginSourceID)