Ejemplo n.º 1
0
        /// <summary>
        /// Generates the login URL.
        /// </summary>
        /// <param name="generatePopUpUrl">
        /// if set to <c>true</c> [generate pop up URL].
        /// </param>
        /// <param name="connectCurrentUser">
        /// if set to <c>true</c> [connect current user].
        /// </param>
        /// <returns>
        /// Returns the Login URL
        /// </returns>
        public string GenerateLoginUrl(bool generatePopUpUrl, bool connectCurrentUser = false)
        {
            var oAuth = new OAuthTwitter
                            {
                                CallBackUrl =
                                    "{0}auth.aspx?auth={1}{2}".FormatWith(
                                        YafForumInfo.ForumBaseUrl, 
                                        AuthService.twitter, 
                                        connectCurrentUser ? "&connectCurrent=true" : string.Empty), 
                                ConsumerKey = Config.TwitterConsumerKey, 
                                ConsumerSecret = Config.TwitterConsumerSecret
                            };

            return generatePopUpUrl
                       ? "javascript:window.open('{0}', 'Twitter Login Window', 'width=800,height=700,left=150,top=100,scrollbar=no,resize=no'); return false;"
                             .FormatWith(oAuth.AuthorizationLinkGet())
                       : oAuth.AuthorizationLinkGet();
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Generates the login URL.
        /// </summary>
        /// <param name="generatePopUpUrl">if set to <c>true</c> [generate pop up URL].</param>
        /// <param name="connectCurrentUser">if set to <c>true</c> [connect current user].</param>
        /// <returns>Returns the Login URL</returns>
        public string GenerateLoginUrl(bool generatePopUpUrl, bool connectCurrentUser = false)
        {
            var oAuth = new OAuthTwitter
            {
                CallBackUrl =
                    "{0}auth.aspx?auth={1}{2}".FormatWith(
                        YafForumInfo.ForumBaseUrl,
                        AuthService.twitter,
                        connectCurrentUser ? "&connectCurrent=true" : string.Empty),
                ConsumerKey    = Config.TwitterConsumerKey,
                ConsumerSecret = Config.TwitterConsumerSecret
            };

            return(generatePopUpUrl
                       ? "javascript:window.open('{0}', 'Twitter Login Window', 'width=800,height=700,left=150,top=100,scrollbar=no,resize=no'); return false;"
                   .FormatWith(oAuth.AuthorizationLinkGet())
                       : oAuth.AuthorizationLinkGet());
        }