Пример #1
0
        /// <summary>
        /// 业务逻辑处理
        /// </summary>
        /// <returns>false:中断后面的方式执行并返回Error</returns>
        public override bool TakeAction()
        {
            string key = CryptoHelper.MD5_Encrypt("" + _serverId + _tstamp + GlobalDefine.LoginSwitch_Key, Encoding.UTF8);

            if (key == _word && !SocialHelper.IsExistSocialS())
            {
                Current.Bind(new SessionUser()
                {
                    UserId = (int)GlobalDefine.ServerIdType.SocialId, PassportId = string.Format("SocialS-{0}", _serverId)
                });
                //设置忽略锁
                Current.SetIgoreLock(true, actionId);
                SocialHelper.SetSocialS(Current);
                _packet.Ret = 1;
            }
            else
            {
                _packet.Ret = 0;
            }

            //
            SendLoginResult();
            //
            IsNotRespond = true;

            return(true);
        }
Пример #2
0
 protected void Page_Load(Object sender, EventArgs args)
 {
     if (SocialHelper.GetLinkedInAuthenticationState().HasNoText())
     {
         SocialHelper.SetLinkedInAuthenticationState();
     }
 }
        private void BindData(ContentPageItem page)
        {
            hlFacebook.NavigateUrl = SocialHelper.GetFacebookShareUrl(page);
            hlFacebook.Text        = DictionaryConstants.SocialSharingFacebook;

            hlGooglePlus.NavigateUrl = SocialHelper.GetGooglePlusShareUrl(page);
            hlGooglePlus.Text        = DictionaryConstants.SocialSharingGooglePlus;

            hlTwitter.NavigateUrl = SocialHelper.GetTwitterShareUrl(page, page.PageTitle.Raw);
            hlTwitter.Text        = DictionaryConstants.SocialSharingTwitter;

            hlPinterest.NavigateUrl = SocialHelper.GetPinterestShareUrl(page);
        }
Пример #4
0
        public async Task <IActionResult> GetUserInfo(AccountProviderNames provider, string token)
        {
            var loginInfo = provider == AccountProviderNames.Facebook ? await _facebookHelper.GetLoginProviderAsync(token) :
                            await SocialHelper.VerifyGoogleTokenAsync(token);

            if (loginInfo == null)
            {
                this.AddAlertDanger($"Lỗi khi lấy thông tin từ hệ thống {provider}. Xin vui lòng thử lại. Token {token}");
                return(RedirectToAction("Login"));
            }

            var accountProvider = await _accountService.GetAccountProviderByProvider(provider, loginInfo.ProviderId, token);

            if (accountProvider.FbProfileLink.Contains("facebook.com/app_scoped_user_id"))
            {
                return(RedirectToAction("ChangeFacebookUrl", "Account"));
            }



            var accountProviderExist = accountProvider != null;

            var auth = await _accountService.GetAuth(loginInfo);

            if (auth == null)
            {
                this.AddAlertDanger("Lỗi khi lấy thông tin đăng nhập. Tài khoản đã bị khóa hoặc xóa. Xin vui lòng liên hệ quản trị hệ thống");
                return(RedirectToAction("Login"));
            }

            if (provider == AccountProviderNames.Facebook)
            {
                BackgroundJob.Enqueue <IFacebookJob>(m => m.ExtendAccessToken());
                if (!accountProviderExist)
                {
                    BackgroundJob.Enqueue <IFacebookJob>(m => m.UpdateFbPost(auth.Id, auth.Username, 1));
                }
            }


            await SignIn(auth);

            return(RedirectToAction("Index", "Account"));
        }
Пример #5
0
        public async Task <IActionResult> LinkProvider(AccountProviderNames provider, string token, string returnurl)
        {
            var info = provider == AccountProviderNames.Facebook ? await _facebookHelper.GetLoginProviderAsync(token) :
                       await SocialHelper.VerifyGoogleTokenAsync(token);

            if (info == null)
            {
                this.AddAlertDanger($"Lỗi khi lấy thông tin từ hệ thống {provider}. Xin vui lòng thử lại. Token {token}");
            }
            else
            {
                var r = await _accountService.UpdateAccountProvider(CurrentUser.Id, new UpdateAccountProviderViewModel()
                {
                    Email      = info.Email,
                    Image      = info.Image,
                    Name       = info.Name,
                    Provider   = provider,
                    ProviderId = info.ProviderId
                }, CurrentUser.Username);

                if (r < 0)
                {
                    this.AddAlertDanger($"Tài khoản {info.Provider} đã được liên kết với tài khoản khác. Vui lòng thử lại tài khoản khác");
                }
                else
                {
                    BackgroundJob.Enqueue <IFacebookJob>(m => m.ExtendAccessToken());
                    this.AddAlertSuccess($"Liên kết Tài khoản {info.Provider} thành công");


                    if (r == 2)
                    { // tao moi fb id -> add new FbPost tu 2018
                        BackgroundJob.Enqueue <IFacebookJob>(m => m.UpdateFbPost(CurrentUser.Id, CurrentUser.Username, 1));
                    }
                }
            }

            if (!string.IsNullOrEmpty(returnurl))
            {
                return(Redirect(returnurl));
            }
            return(RedirectToAction("Index"));
        }
        protected void rptFavorites_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            var       item             = e.Item.DataItem as FavoritesModel;
            HyperLink hypFavoriteTitle = (HyperLink)e.Item.FindControl("hypFavoriteTitle");

            hypFavoriteTitle.NavigateUrl = item.Url;
            hypFavoriteTitle.Text        = item.Title;
            Literal litType = (Literal)e.Item.FindControl("litType");

            litType.Text = item.Type;
            HyperLink hypReplyCount = (HyperLink)e.Item.FindControl("hypReplyCount");

            hypReplyCount.NavigateUrl = item.Url;
            hypReplyCount.Text        = "<span>" + item.ReplyCount + "</span>";

            HtmlButton lbUnSave = (HtmlButton)e.Item.FindControl("lbUnSave");

            lbUnSave.ServerClick += new EventHandler(lbUnsave_Click);

            HyperLink hlFacebook = (HyperLink)e.Item.FindControl("hlFacebook");

            hlFacebook.NavigateUrl = SocialHelper.GetFacebookShareUrl(Sitecore.Context.Database.GetItem(item.ContentId));

            Literal ltlFacebook = (Literal)e.Item.FindControl("ltlFacebook");

            ltlFacebook.Text = DictionaryConstants.SocialSharingFacebook;

            HyperLink hlGooglePlus = (HyperLink)e.Item.FindControl("hlGooglePlus");

            hlGooglePlus.NavigateUrl = SocialHelper.GetGooglePlusShareUrl(Sitecore.Context.Database.GetItem(item.ContentId));

            Literal ltlGooglePlus = (Literal)e.Item.FindControl("ltlGooglePlus");

            ltlGooglePlus.Text = DictionaryConstants.SocialSharingGooglePlus;

            HyperLink hlTwitter = (HyperLink)e.Item.FindControl("hlTwitter");

            hlTwitter.NavigateUrl = SocialHelper.GetTwitterShareUrl(Sitecore.Context.Database.GetItem(item.ContentId), item.Title);

            Literal ltlTwitter = (Literal)e.Item.FindControl("ltlTwitter");

            ltlTwitter.Text = DictionaryConstants.SocialSharingTwitter;
        }
Пример #7
0
        /// <summary>
        /// Shares on file maximum
        /// </summary>
        /// <param name="body"></param>
        /// <param name="filePath">The path to the attached file</param>
        /// <param name="url"></param>
        /// <param name="subject"></param>
        /// <param name="mimeType"></param>
        /// <param name="chooser"></param>
        /// <param name="chooserText"></param>
        public static void Share(Notification _notif)
        {
            SocialHelper sh = _notif.param as SocialHelper;

            ShareMultiple(sh.m_Body, new string[] { sh.m_FilePath }, sh.m_URL, sh.m_Subject, sh.m_MimeType, false, "Select sharing app");
        }
Пример #8
0
 /// <summary>
 /// 业务逻辑处理
 /// </summary>
 /// <returns>false:中断后面的方式执行并返回Error</returns>
 public override bool TakeAction()
 {
     SocialHelper.OnCloseSocialSBefore(Current);
     return(true);
 }
Пример #9
0
 /// <summary>
 /// 业务逻辑处理
 /// </summary>
 /// <returns>false:中断后面的方式执行并返回Error</returns>
 public override bool TakeAction()
 {
     SocialHelper.SendDesActionToSocialServer((HttpGet)httpGet);
     return(true);
 }