Пример #1
0
    /// <summary>
    /// Checks to see if user is logged in.
    /// </summary>
    private void checkToSeeIfUserIsLoggedIn()
    {
        if (IsPublic)
        {
            return;                                                                 // it doesn't matter
        }
        if (ConciergeAPI.CurrentUser == null || ConciergeAPI.CurrentEntity == null) // we're not logged in
        {
            // is there an auto login set?
            // the auto login will automatically try to log in the user specified in the config
            // this is helpful during development, where you don't want to constantly have to
            // relogin for each compile


            if (ConfigurationManager.AppSettings["AutoLoginName"] != null)
            {
                using (var api = GetConciegeAPIProxy())
                    ConciergeAPI.SetSession(
                        api.LoginToPortal(ConfigurationManager.AppSettings["AutoLoginName"],
                                          ConfigurationManager.AppSettings["AutoLoginPassword"]).ResultValue);
                MultiStepWizards.ClearAll();
                return;
            }


            GoTo("/Login.aspx?redirectURL=" + Server.UrlEncode(Request.Url.PathAndQuery));
            return;
        }

        if (CheckMustChangePassword && ConciergeAPI.CurrentUser.MustChangePassword)
        {
            GoTo("~/profile/ChangePassword.aspx");
            return;
        }
    }
Пример #2
0
    protected void btnContinue_Click(object sender, EventArgs e)
    {
        using (var serviceProxy = GetServiceAPIProxy())
        {
            LoginResult login;

            try
            {
                login = serviceProxy.LoginPortalUserWithHash(
                    UserId, PasswordHash).ResultValue;
            }
            catch (ConciergeClientException)
            {
                QueueBannerError("Unable to reset password.");
                GoTo("~/Login.aspx");
                return;
            }
            ConciergeAPI.SetSession(login);

            serviceProxy.ResetPassword(ConciergeAPI.CurrentUser.ID, tbPassword.Text);
            ConciergeAPI.CurrentUser.MustChangePassword = false;
        }

        // allow us to bypass multiple identity check by explicitly redirecting to "/" if necessary
        if (string.IsNullOrWhiteSpace(NextUrl))
        {
            CRMLogic.CheckToSeeIfMultipleIdentitiesAreAccessible();
        }

        GoTo(!string.IsNullOrWhiteSpace(NextUrl) ? NextUrl : "/");
    }
Пример #3
0
    private void setSessionAndForward(LoginResult loginResult)
    {
        ConciergeAPI.SetSession(loginResult);             // set the session
        SessionManager.Set <object>("PortalLinks", null); // force portal link reload, so non-public links now show

        CRMLogic.CheckToSeeIfMultipleIdentitiesAreAccessible();

        //If this login was initiated by a Single Sign On then check for the next URL to show the user
        if (!string.IsNullOrWhiteSpace(Request.Form["NextUrl"]))
        {
            string nextUrl = Request.Form["NextUrl"];
            if (!string.IsNullOrWhiteSpace(nextUrl) && Uri.IsWellFormedUriString(nextUrl, UriKind.RelativeOrAbsolute))
            {
                Response.Redirect(nextUrl);
            }
        }

        // is there a redirect URL?
        var redirectURL = Request.QueryString["redirectUrl"];

        if (!string.IsNullOrWhiteSpace(redirectURL))
        {
            Response.Redirect(redirectURL);
        }


        GoHome(); // go home
    }
Пример #4
0
    private void setSessionAndForward(LoginResult loginResult)
    {
        ConciergeAPI.SetSession(loginResult); // set the session

        if (!string.IsNullOrEmpty(MultiStepWizards.CreateAccount.CompleteUrl))
        {
            GoTo(MultiStepWizards.CreateAccount.CompleteUrl);
        }

        GoHome();   // go home
    }
Пример #5
0
    private void Logout(bool redirect)
    {
        ConciergeAPI.ClearSession();
        SessionManager.Set <object>("PortalLinks", null);  // force portal link reload, so non-public links don't show

        var logoutUrl = ConciergeAPI.LogoutUrl;

        SessionManager.Clear();

        if (redirect)
        {
            Response.Redirect(!string.IsNullOrWhiteSpace(logoutUrl)
                                  ? logoutUrl
                                  : "~/Login.aspx");
        }
    }
Пример #6
0
    public string ResolveResource(string resourceName, bool returnNullIfNothingFound)
    {
        //Check for a local resource file first so that any settings there take precedence
        try
        {
            var localResourceObject = GetLocalResourceObject(resourceName);
            if (localResourceObject != null)
            {
                string result = localResourceObject.ToString();
                if (!String.IsNullOrWhiteSpace(result))
                {
                    return(result);
                }
            }
        }
        catch {}

        //There was no local resource file or no resource matching the specified name so check from the API
        return(ConciergeAPI.ResolveResource(resourceName, returnNullIfNothingFound));
    }
Пример #7
0
    protected void Page_Load(object sender, EventArgs e)
    {
        ConciergeAPI.ClearSession();
        SessionManager.Set <object>("PortalLinks", null);  // force portal link reload, so non-public links don't show

        var logoutUrl = ConciergeAPI.LogoutUrl;

        SessionManager.Clear();

        if (!string.IsNullOrWhiteSpace(NextUrl) && Uri.IsWellFormedUriString(NextUrl, UriKind.RelativeOrAbsolute))
        {
            Response.Redirect(NextUrl);
            return;
        }

        if (!string.IsNullOrWhiteSpace(logoutUrl))
        {
            Response.Redirect(logoutUrl);
            return;
        }

        Response.Redirect("~/Login.aspx");
    }
Пример #8
0
    /// <summary>
    /// Determines whether [is module active] [the specified module to check].
    /// </summary>
    /// <param name="moduleToCheck">The module to check.</param>
    /// <returns>
    ///     <c>true</c> if [is module active] [the specified module to check]; otherwise, <c>false</c>.
    /// </returns>
    public static bool IsModuleActive(string moduleToCheck)
    {
        bool result = ConciergeAPI.IsModuleActive(moduleToCheck);

        return(result);
    }