]> source.dussan.org Git - gitea.git/commitdiff
clean tail
authorskyblue <ssx205@gmail.com>
Tue, 8 Apr 2014 16:31:09 +0000 (00:31 +0800)
committerskyblue <ssx205@gmail.com>
Tue, 8 Apr 2014 16:31:09 +0000 (00:31 +0800)
models/oauth2.go
routers/user/social.go

index 10771d6a73f76207b7669f6b0b0bdc9881235e7a..4da98006708218d40ef39f8413594e7d43c29363 100644 (file)
@@ -1,9 +1,6 @@
 package models
 
-import (
-       "errors"
-       "fmt"
-)
+import "errors"
 
 // OT: Oauth2 Type
 const (
@@ -41,8 +38,7 @@ func GetOauth2(identity string) (oa *Oauth2, err error) {
                return
        }
        if !exists {
-               err = fmt.Errorf("not exists oauth2: %s", identity)
-               return
+               return nil, ErrOauth2RecordNotExists
        }
        if oa.Uid == 0 {
                return oa, ErrOauth2NotAssociatedWithUser
index b47a4c1cefef0c25fd3fc2dd9ebd7fdcc6c86310..7b4d232987f8dc3ede25d22143c61f1ce2beaa98 100644 (file)
@@ -109,6 +109,9 @@ func SocialSignIn(ctx *middleware.Context, tokens oauth2.Tokens) {
                }
        case models.ErrOauth2NotAssociatedWithUser:
                // pass
+       default:
+               log.Error(err) // FIXME: handle error page
+               return
        }
        ctx.Session.Set("socialId", oa.Id)
        log.Info("socialId: %v", oa.Id)