package models | package models | ||||
import ( | |||||
"errors" | |||||
"fmt" | |||||
) | |||||
import "errors" | |||||
// OT: Oauth2 Type | // OT: Oauth2 Type | ||||
const ( | const ( | ||||
return | return | ||||
} | } | ||||
if !exists { | if !exists { | ||||
err = fmt.Errorf("not exists oauth2: %s", identity) | |||||
return | |||||
return nil, ErrOauth2RecordNotExists | |||||
} | } | ||||
if oa.Uid == 0 { | if oa.Uid == 0 { | ||||
return oa, ErrOauth2NotAssociatedWithUser | return oa, ErrOauth2NotAssociatedWithUser |
} | } | ||||
case models.ErrOauth2NotAssociatedWithUser: | case models.ErrOauth2NotAssociatedWithUser: | ||||
// pass | // pass | ||||
default: | |||||
log.Error(err) // FIXME: handle error page | |||||
return | |||||
} | } | ||||
ctx.Session.Set("socialId", oa.Id) | ctx.Session.Set("socialId", oa.Id) | ||||
log.Info("socialId: %v", oa.Id) | log.Info("socialId: %v", oa.Id) |