Compare commits

...

6 Commits

Author SHA1 Message Date
bbe6aa349f fix bug not to trim space of login username (#1806) 2017-05-29 06:10:11 -05:00
agrn
4fd55d8796 Backport bugfixes #1220 and #1393 to v1.1 (#1758)
* Fix "Error: No issue number specified"  when pushing

* fix wrong log when push to a new branch (#1220)

* Removing empty file modules/github/issues.go
2017-05-20 12:43:43 +08:00
Jonas Östanbäck
daaabaa1d9 Enforce netgo build tag while cross-compilation (Backport of #1690) (#1731) 2017-05-18 09:04:12 +08:00
fa059debca fix delete user failed on sqlite (#1321) 2017-05-17 12:43:22 +02:00
Kim "BKC" Carlbäcker
2854c8aa47 Merge pull request #1724 from lunny/lunny/fix_avatar_update
fix update avatar
2017-05-15 17:16:31 +02:00
506c98df5b fix update avatar 2017-05-14 13:39:53 +08:00
6 changed files with 19 additions and 13 deletions

View File

@ -112,7 +112,7 @@ release-windows:
@hash xgo > /dev/null 2>&1; if [ $$? -ne 0 ]; then \
go get -u github.com/karalabe/xgo; \
fi
xgo -dest $(DIST)/binaries -tags '$(TAGS)' -ldflags '-linkmode external -extldflags "-static" $(LDFLAGS)' -targets 'windows/*' -out gitea-$(VERSION) .
xgo -dest $(DIST)/binaries -tags 'netgo $(TAGS)' -ldflags '-linkmode external -extldflags "-static" $(LDFLAGS)' -targets 'windows/*' -out gitea-$(VERSION) .
ifeq ($(CI),drone)
mv /build/* $(DIST)/binaries
endif
@ -122,7 +122,7 @@ release-linux:
@hash xgo > /dev/null 2>&1; if [ $$? -ne 0 ]; then \
go get -u github.com/karalabe/xgo; \
fi
xgo -dest $(DIST)/binaries -tags '$(TAGS)' -ldflags '-linkmode external -extldflags "-static" $(LDFLAGS)' -targets 'linux/*' -out gitea-$(VERSION) .
xgo -dest $(DIST)/binaries -tags 'netgo $(TAGS)' -ldflags '-linkmode external -extldflags "-static" $(LDFLAGS)' -targets 'linux/*' -out gitea-$(VERSION) .
ifeq ($(CI),drone)
mv /build/* $(DIST)/binaries
endif
@ -132,7 +132,7 @@ release-darwin:
@hash xgo > /dev/null 2>&1; if [ $$? -ne 0 ]; then \
go get -u github.com/karalabe/xgo; \
fi
xgo -dest $(DIST)/binaries -tags '$(TAGS)' -ldflags '$(LDFLAGS)' -targets 'darwin/*' -out gitea-$(VERSION) .
xgo -dest $(DIST)/binaries -tags 'netgo $(TAGS)' -ldflags '$(LDFLAGS)' -targets 'darwin/*' -out gitea-$(VERSION) .
ifeq ($(CI),drone)
mv /build/* $(DIST)/binaries
endif

View File

@ -360,7 +360,7 @@ func UpdateIssuesCommit(doer *User, repo *Repository, commits []*PushCommit) err
issue, err := GetIssueByRef(ref)
if err != nil {
if IsErrIssueNotExist(err) {
if IsErrIssueNotExist(err) || err == errMissingIssueNumber {
continue
}
return err
@ -398,7 +398,7 @@ func UpdateIssuesCommit(doer *User, repo *Repository, commits []*PushCommit) err
issue, err := GetIssueByRef(ref)
if err != nil {
if IsErrIssueNotExist(err) {
if IsErrIssueNotExist(err) || err == errMissingIssueNumber {
continue
}
return err
@ -438,7 +438,7 @@ func UpdateIssuesCommit(doer *User, repo *Repository, commits []*PushCommit) err
issue, err := GetIssueByRef(ref)
if err != nil {
if IsErrIssueNotExist(err) {
if IsErrIssueNotExist(err) || err == errMissingIssueNumber {
continue
}
return err

View File

@ -9,8 +9,8 @@ import "github.com/markbates/goth"
// ExternalLoginUser makes the connecting between some existing user and additional external login sources
type ExternalLoginUser struct {
ExternalID string `xorm:"NOT NULL"`
UserID int64 `xorm:"NOT NULL"`
LoginSourceID int64 `xorm:"NOT NULL"`
UserID int64 `xorm:"NOT NULL"`
LoginSourceID int64 `xorm:"NOT NULL"`
}
// GetExternalLogin checks if a externalID in loginSourceID scope already exists
@ -67,8 +67,8 @@ func RemoveAccountLink(user *User, loginSourceID int64) (int64, error) {
return deleted, err
}
// RemoveAllAccountLinks will remove all external login sources for the given user
func RemoveAllAccountLinks(user *User) error {
_, err := x.Delete(&ExternalLoginUser{UserID: user.ID})
// removeAllAccountLinks will remove all external login sources for the given user
func removeAllAccountLinks(e Engine, user *User) error {
_, err := e.Delete(&ExternalLoginUser{UserID: user.ID})
return err
}

View File

@ -635,7 +635,12 @@ func UserSignIn(username, password string) (*User, error) {
}
}
} else {
user = &User{LowerName: strings.ToLower(strings.TrimSpace(username))}
trimmedUsername := strings.TrimSpace(username)
if len(trimmedUsername) == 0 {
return nil, ErrUserNotExist{0, username, 0}
}
user = &User{LowerName: strings.ToLower(trimmedUsername)}
}
hasUser, err := x.Get(user)

View File

@ -34,6 +34,7 @@ func useNewNameAvatars(x *xorm.Engine) error {
}
type User struct {
ID int64 `xorm:"pk autoincr"`
Avatar string
UseCustomAvatar bool
}

View File

@ -989,7 +989,7 @@ func deleteUser(e *xorm.Session, u *User) error {
}
// ***** START: ExternalLoginUser *****
if err = RemoveAllAccountLinks(u); err != nil {
if err = removeAllAccountLinks(e, u); err != nil {
return fmt.Errorf("ExternalLoginUser: %v", err)
}
// ***** END: ExternalLoginUser *****