mirror of https://github.com/gogs/gogs.git
parent
880d0ec19f
commit
047bf94908
|
@ -1,20 +1,18 @@
|
|||
os: linux
|
||||
language: go
|
||||
os: linux
|
||||
dist: xenial
|
||||
go:
|
||||
- 1.13.x
|
||||
- 1.14.x
|
||||
go_import_path: gogs.io/gogs
|
||||
|
||||
env:
|
||||
- GO111MODULE=on
|
||||
|
||||
before_install:
|
||||
- sudo apt-get update -qq
|
||||
- sudo apt-get install -y libpam-dev
|
||||
|
||||
script:
|
||||
- go vet ./...
|
||||
- go build -v -tags "pam"
|
||||
- go test -v -race -coverprofile=coverage.txt -covermode=atomic ./...
|
||||
|
||||
after_success:
|
||||
- bash <(curl -s https://codecov.io/bash)
|
||||
|
|
4
Makefile
4
Makefile
|
@ -31,10 +31,6 @@ dist: release
|
|||
web: build
|
||||
./gogs web
|
||||
|
||||
govet:
|
||||
$(GOVET) gogs.go
|
||||
$(GOVET) models pkg routes
|
||||
|
||||
build: $(GENERATED)
|
||||
go build $(BUILD_FLAGS) -ldflags '$(LDFLAGS)' -tags '$(TAGS)' -trimpath -o gogs
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -39,7 +39,7 @@ type Mirror struct {
|
|||
NextSync time.Time `xorm:"-" json:"-"`
|
||||
NextSyncUnix int64 `xorm:"next_update_unix"`
|
||||
|
||||
address string `xorm:"-" json:"-"`
|
||||
address string `xorm:"-"`
|
||||
}
|
||||
|
||||
func (m *Mirror) BeforeInsert() {
|
||||
|
|
|
@ -437,10 +437,10 @@ type HookTask struct {
|
|||
|
||||
func (t *HookTask) BeforeUpdate() {
|
||||
if t.RequestInfo != nil {
|
||||
t.RequestContent = t.MarshalJSON(t.RequestInfo)
|
||||
t.RequestContent = t.ToJSON(t.RequestInfo)
|
||||
}
|
||||
if t.ResponseInfo != nil {
|
||||
t.ResponseContent = t.MarshalJSON(t.ResponseInfo)
|
||||
t.ResponseContent = t.ToJSON(t.ResponseInfo)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -472,7 +472,7 @@ func (t *HookTask) AfterSet(colName string, _ xorm.Cell) {
|
|||
}
|
||||
}
|
||||
|
||||
func (t *HookTask) MarshalJSON(v interface{}) string {
|
||||
func (t *HookTask) ToJSON(v interface{}) string {
|
||||
p, err := jsoniter.Marshal(v)
|
||||
if err != nil {
|
||||
log.Error("Marshal [%d]: %v", t.ID, err)
|
||||
|
|
Loading…
Reference in New Issue