Example #1
0
    /// <summary>
    /// Initializes the control properties.
    /// </summary>
    protected void SetupControl()
    {
        if (StopProcessing)
        {
            this.Visible = false;
        }
        else
        {
            // Check renamed DLL library
            if (CMSOpenIDHelper.CheckOpenIdDLL())
            {
                // Check if OpenID module is enabled
                if (SettingsKeyProvider.GetBoolValue(CMSContext.CurrentSiteName + ".CMSEnableOpenID"))
                {
                    ltlScript.Text = ScriptHelper.GetIncludeScript(PROVIDERS_LOCATION + "OpenIDSelector.js");
                    lblError.Text  = GetString("openid.invalidid");

                    SetProviders();
                    DisplayButtons();

                    openIDhelper = new CMSOpenIDHelper();
                    CheckStatus();
                }
                else
                {
                    // Error label is displayed in Design mode when OpenID is disabled
                    if (CMSContext.ViewMode == ViewModeEnum.Design)
                    {
                        StringBuilder parameter = new StringBuilder();
                        parameter.Append(GetString("header.sitemanager") + " -> ");
                        parameter.Append(GetString("settingscategory.cmssettings") + " -> ");
                        parameter.Append(GetString("settingscategory.cmsmembership") + " -> ");
                        parameter.Append(GetString("settingscategory.cmsmembershipauthentication") + " -> ");
                        parameter.Append(GetString("settingscategory.cmsopenid"));
                        if (CMSContext.CurrentUser.UserSiteManagerAdmin)
                        {
                            // Make it link for SiteManager Admin
                            parameter.Insert(0, "<a href=\"" + URLHelper.GetAbsoluteUrl("~/CMSSiteManager/default.aspx?section=settings") + "\" target=\"_top\">");
                            parameter.Append("</a>");
                        }

                        lblError.Text    = String.Format(GetString("mem.openid.disabled"), parameter.ToString());
                        lblError.Visible = true;
                        txtInput.Visible = false;
                    }
                    else
                    {
                        this.Visible = false;
                    }
                }
            }
            // Error label is displayed in Design mode when OpenID library is not enabled
            else
            {
                lblError.Text    = ResHelper.GetString("mem.openid.library");
                lblError.Visible = true;
                txtInput.Visible = false;
            }
        }
    }
Example #2
0
    /// <summary>
    /// Initializes the control properties.
    /// </summary>
    protected void SetupControl()
    {
        if (!this.StopProcessing)
        {
            // Check renamed DLL library
            if (CMSOpenIDHelper.CheckOpenIdDLL())
            {
                // Check if LinkedIn module is enabled
                if (LinkedInHelper.LinkedInIsAvailable(CMSContext.CurrentSiteName))
                {
                    DisplayButtons();
                    linkedInHelper = new LinkedInHelper();
                    CheckStatus();
                }
                else
                {
                    // Error label is displayed in Design mode when LinkedIn is disabled
                    if (CMSContext.ViewMode == ViewModeEnum.Design)
                    {
                        StringBuilder parameter = new StringBuilder();
                        parameter.Append(GetString("header.sitemanager") + " -> ");
                        parameter.Append(GetString("settingscategory.cmssettings") + " -> ");
                        parameter.Append(GetString("settingscategory.cmsmembership") + " -> ");
                        parameter.Append(GetString("settingscategory.cmsmembershipauthentication") + " -> ");
                        parameter.Append(GetString("settingscategory.cmslinkedin"));
                        if (CMSContext.CurrentUser.UserSiteManagerAdmin)
                        {
                            // Make it link for SiteManager Admin
                            parameter.Insert(0, "<a href=\"" + URLHelper.GetAbsoluteUrl("~/CMSSiteManager/default.aspx?section=settings") + "\" target=\"_top\">");
                            parameter.Append("</a>");
                        }

                        lblError.Text    = String.Format(GetString("mem.linkedin.disabled"), parameter.ToString());
                        lblError.Visible = true;
                    }
                    else
                    {
                        this.Visible = false;
                    }
                }
            }
            // Error label is displayed in Design mode when LinkedIn library is not loaded
            else
            {
                lblError.ResourceString = "mem.openid.library";
                lblError.Visible        = true;
            }
        }
        else
        {
            this.Visible = false;
        }
    }
Example #3
0
    /// <summary>
    /// Initializes the control properties.
    /// </summary>
    protected void SetupControl()
    {
        if (!StopProcessing)
        {
            plcError.Visible = false;

            // Check renamed DLL library
            if (!CMSOpenIDHelper.CheckOpenIdDLL())
            {
                // Error label is displayed when OpenID library is not enabled
                lblError.Text      = ResHelper.GetString("mem.openid.library");
                plcError.Visible   = true;
                plcContent.Visible = false;
            }

            // Check if OpenID module is enabled
            if (!SettingsKeyProvider.GetBoolValue(CMSContext.CurrentSiteName + ".CMSEnableOpenID") && !plcError.Visible)
            {
                // Error label is displayed only in Design mode
                if (CMSContext.ViewMode == ViewModeEnum.Design)
                {
                    StringBuilder parameter = new StringBuilder();
                    parameter.Append(GetString("header.sitemanager") + " -> ");
                    parameter.Append(GetString("settingscategory.cmssettings") + " -> ");
                    parameter.Append(GetString("settingscategory.cmsmembership") + " -> ");
                    parameter.Append(GetString("settingscategory.cmsmembershipauthentication") + " -> ");
                    parameter.Append(GetString("settingscategory.cmsopenid"));
                    if (CMSContext.CurrentUser.UserSiteManagerAdmin)
                    {
                        // Make it link for SiteManager Admin
                        parameter.Insert(0, "<a href=\"" + URLHelper.GetAbsoluteUrl("~/CMSSiteManager/default.aspx?section=settings") + "\" target=\"_top\">");
                        parameter.Append("</a>");
                    }

                    lblError.Text      = String.Format(GetString("mem.openid.disabled"), parameter.ToString());
                    plcError.Visible   = true;
                    plcContent.Visible = false;
                }
                // In other modes is webpart hidden
                else
                {
                    Visible = false;
                }
            }

            // Display webpart when no error occured
            if (!plcError.Visible && Visible)
            {
                if (!CMSContext.CurrentUser.IsAuthenticated())
                {
                    plcPasswordNew.Visible  = AllowFormsAuthentication;
                    pnlExistingUser.Visible = AllowExistingUser;

                    // Initialize OpenID session
                    response = (Dictionary <string, object>)SessionHelper.GetValue(SESSION_NAME_USERDATA);

                    userProviderUrl = ValidationHelper.GetString(SessionHelper.GetValue(SESSION_NAME_URL), null);

                    // Check that OpenID is not already registered
                    if (response != null)
                    {
                        UserInfo ui = OpenIDUserInfoProvider.GetUserInfoByOpenID((string)response["ClaimedIdentifier"]);

                        // OpenID is already registered to some user
                        if (ui != null)
                        {
                            plcContent.Visible = false;
                            plcError.Visible   = true;
                            lblError.Text      = GetString("mem.openid.openidregistered");
                        }
                    }

                    // There is no OpenID response object stored in session - hide all
                    if ((response == null) && HideForNoOpenID)
                    {
                        Visible = false;
                    }
                    else if (!RequestHelper.IsPostBack())
                    {
                        LoadData();
                    }
                }
                // Hide webpart for authenticated users
                else
                {
                    Visible = false;
                }
            }
        }
        // Hide control when StopProcessing = TRUE
        else
        {
            Visible = false;
        }
    }
    /// <summary>
    /// Initializes the control properties.
    /// </summary>
    protected void SetupControl()
    {
        if (!StopProcessing)
        {
            plcError.Visible = false;

            // Check renamed DLL library
            if (!CMSOpenIDHelper.CheckOpenIdDLL())
            {
                // Error label is displayed when OpenID library is not enabled
                lblError.ResourceString = "mem.openid.library";
                plcError.Visible        = true;
                plcContent.Visible      = false;
            }

            string currentSiteName = CMSContext.CurrentSiteName;

            // Check if LinkedIn module is enabled
            if (!LinkedInHelper.LinkedInIsAvailable(CMSContext.CurrentSiteName) && !plcError.Visible)
            {
                // Error label is displayed only in Design mode
                if (CMSContext.ViewMode == ViewModeEnum.Design)
                {
                    StringBuilder parameter = new StringBuilder();
                    parameter.Append(GetString("header.sitemanager") + " -> ");
                    parameter.Append(GetString("settingscategory.cmssettings") + " -> ");
                    parameter.Append(GetString("settingscategory.socialnetworks") + " -> ");
                    parameter.Append(GetString("settingscategory.cmslinkedin"));
                    if (CMSContext.CurrentUser.UserSiteManagerAdmin)
                    {
                        // Make it link for SiteManager Admin
                        parameter.Insert(0, "<a href=\"" + URLHelper.GetAbsoluteUrl("~/CMSSiteManager/default.aspx?section=settings") + "\" target=\"_top\">");
                        parameter.Append("</a>");
                    }

                    lblError.Text      = String.Format(GetString("mem.linkedin.disabled"), parameter.ToString());
                    plcError.Visible   = true;
                    plcContent.Visible = false;
                }
                // In other modes is webpart hidden
                else
                {
                    Visible = false;
                }
            }

            // Display webpart when no error occured
            if (!plcError.Visible && Visible)
            {
                // Hide webpart if user is authenticated
                if (CMSContext.CurrentUser.IsAuthenticated())
                {
                    Visible = false;
                    return;
                }

                plcPasswordNew.Visible  = AllowFormsAuthentication;
                pnlExistingUser.Visible = AllowExistingUser;

                linkedInHelper = new LinkedInHelper();
                linkedInHelper.Initialize(SessionHelper.GetValue(SESSION_NAME_USERDATA) as XmlDocument);

                // There is no LinkedIn user ID stored in session - hide all
                if (string.IsNullOrEmpty(linkedInHelper.MemberId) && HideForNoLinkedInUserID)
                {
                    Visible = false;
                }
                else if (!RequestHelper.IsPostBack())
                {
                    LoadData();
                }
            }
        }
        else
        {
            Visible = false;
        }
    }