private void redirectQQWeiboRegister(WeiboType type, OauthKey key,string screenName,string profileImg) { UserWeiboSetting setting = new UserWeiboSetting { AccessToken = key.tokenKey, AccessSecret = key.tokenSecret, IsSync = 1, WeiboType = type.Id, AppId = ctx.owner.Id, BindTime = DateTime.Now, WeiboName = type.Name, WeiboUid = key.WeiboName }; WeiboSession session = new WeiboSession(setting, screenName, type.FriendName, profileImg); ctx.web.SessionSet(WeiboSession.SessionName, session); redirectUrl(to(new WeiboRegisterController().Bind) + "?type=" + setting.WeiboName); }
private void redirectSinaWeiboRegister(WeiboType type, Common.SinaOAuthAccessToken token,string screenName,string profileImg) { UserWeiboSetting setting = new UserWeiboSetting { AccessToken = token.Token, ExpireIn = token.ExpiresIn, IsSync = 1, WeiboUid = token.UserID, RefreshToken = token.RefreshToken, WeiboType = type.Id, AppId = ctx.owner.Id, BindTime = DateTime.Now, WeiboName = type.Name }; WeiboSession session = new WeiboSession(setting,screenName,type.FriendName,profileImg); ctx.web.SessionSet(WeiboSession.SessionName,session); redirectUrl(to(new WeiboRegisterController().Bind) + "?type=" + setting.WeiboName); }
private void processQQWeibo(WeiboType type) { OauthKey key = new OauthKey(type.AppKey, type.AppSecret); bool success = false; try { string callback = ctx.url.SiteUrl.TrimEnd('/') + to(QQWeiboCallback); success = key.GetRequestToken(callback); } catch (Exception ex) { log.Error(ex.Message); } if (success) { ctx.web.SessionSet("qqweibo", key); redirectUrl(key.GetOAuthUrl()); } else { echoRedirect("操作失败,请重试"); } }