/// <summary>
        /// Stores the specified organization identifier and redirects to originally requested URL.
        /// </summary>
        /// <param name="organizationId">The organization identifier.</param>
        internal static void SelectOrganization(Guid organizationId, string redirectUrl, bool validateRedirectUrl, HtmlGenericControl errorDiv)
        {
            try
            {
                if (FrameworkConfiguration.Current.WebApplication.CustomUrl.Enabled)
                {
                    if (validateRedirectUrl)
                    {
                        ActiveInstanceControl.ValidateRedirectUrl(ref redirectUrl, true);
                    }

                    errorDiv.Page.Session.Clear();

                    errorDiv.Page.Response.Redirect(CustomUrlProvider.GetVanityUri(organizationId, Guid.Empty, redirectUrl));
                }
                else
                {
                    UserContext.Current.SelectOrganization(organizationId);

                    //if (validateRedirectUrl)
                    ActiveInstanceControl.ValidateRedirectUrl(ref redirectUrl, true);

                    if (!string.IsNullOrEmpty(redirectUrl))
                    {
                        errorDiv.Page.Response.Redirect(redirectUrl);
                    }
                }
            }
            catch (AuthenticationException ex)
            {
                ActiveInstanceControl.ShowError(ex.Message, errorDiv);
            }
        }
Example #2
0
        private void RedirectAfterLogOn()
        {
            string redirectUrl = this.ReturnUrl;

            ActiveInstanceControl.ValidateRedirectUrl(ref redirectUrl, true);

            Response.Redirect(string.IsNullOrEmpty(redirectUrl) ? ResourceProvider.ActiveOrganizationPageVirtualPath : redirectUrl);
        }
Example #3
0
        protected void List_Action(object sender, CommonGridViewActionEventArgs e)
        {
            if (e == null)
            {
                return;
            }

            if (e.Action == CommandActions.Select)
            {
                Guid userId = ((List.SelectedValue == null) ? Guid.Empty : (Guid)List.SelectedValue);
                List.SelectedIndex = -1;

                if ((m_OrgId != Guid.Empty) && (userId != Guid.Empty))
                {
                    string      loginName = string.Empty;
                    string      password  = string.Empty;
                    DataRowView drv       = LoginProvider.Current.GetLogin(userId);
                    if (drv != null)
                    {
                        loginName = drv["LoginName"].ToString();
                        password  = drv["Password"].ToString();

                        try
                        {
                            LoginProvider.Current.Authenticate(loginName, password, false, false, m_OrgId, m_InstanceId);

                            string redirectUrl = null;
                            ActiveInstanceControl.ValidateRedirectUrl(ref redirectUrl, true);

                            if (!string.IsNullOrEmpty(redirectUrl))
                            {
                                Response.Redirect(redirectUrl);
                            }
                        }
                        catch (AuthenticationException ex)
                        {
                            ErrorPanel.InnerHtml = ex.Message;
                            ErrorPanel.Visible   = true;
                            return;
                        }
                    }
                }

                ErrorPanel.InnerHtml = Resources.LoginElement_FailureText;
                ErrorPanel.Visible   = true;
            }
        }