Browse Source

clean tail

skyblue 11 years ago
parent
commit
24d0ca4aa0
2 changed files with 5 additions and 6 deletions
  1. 2 6
      models/oauth2.go
  2. 3 0
      routers/user/social.go

+ 2 - 6
models/oauth2.go

@@ -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

+ 3 - 0
routers/user/social.go

@@ -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)