Ejemplo n.º 1
0
        private void DoLogin(string username, string password)
        {
            // Block MSH from loggin into FED because it is too well known
            // Block rekoop integration user as well as it should only be using web services
            if (username.Trim().ToLower() == "msh" || username.Trim().ToLower() == "rekoop")
            {
                _lblError.Text = "Invalid logon details";
                return;
            }

            _logonService = new LogonServiceClient();
            LogonReturnValue returnValue;

            returnValue = _logonService.Logon(username, password);

            if (!returnValue.Success)
            {
                _lblError.Text = returnValue.Message;
                return;
            }

            Session[SessionName.LogonName] = username;

            Session["LogonID"] = returnValue.LogonId;

            if (null == Session[SessionName.ControlSettings])
            {
                PopulateControlPermissions(returnValue.UserType);
            }

            Session[SessionName.LogonSettings] = returnValue;

            if (!string.IsNullOrEmpty(returnValue.WebStyleSheet))
            {
                // This session is used for all kind of operation being done on CSS files
                Session[SessionName.StyleSheet] = returnValue.WebStyleSheet;

                // This session is used for security purpose
                // for instance, if user change the CSS contents, then on click of preview button of ChangeStyle.aspx screen
                // the new temperory CSS file is created and this CSS is set to Session[SessionName.StyleSheet]
                // and if user wants to cancel the operation, the Session[SessionName.UserStyleSheet] will set to Session[SessionName.StyleSheet]
                Session[SessionName.UserStyleSheet] = returnValue.WebStyleSheet;
            }

            if (returnValue.UserType == 2)
            {
                _clientService = new ClientServiceClient();
                bool isMember   = true;
                Guid memOrOrgId = Guid.Empty;

                if (returnValue.MemberId == IRIS.Law.WebApp.App_Code.DataConstants.DummyGuid)
                {
                    memOrOrgId = returnValue.OrganisationId;
                    isMember   = false;
                }
                else
                {
                    memOrOrgId = returnValue.MemberId;
                }

                ClientDetailReturnValue _clientReturnValue = _clientService.GetClientDetail(returnValue.LogonId, memOrOrgId,
                                                                                            isMember);

                Session[SessionName.MemberId]       = returnValue.MemberId;
                Session[SessionName.OrganisationId] = returnValue.OrganisationId;
                Session[SessionName.ClientRef]      = _clientReturnValue.ClientReference;
                Session[SessionName.ClientName]     = _clientReturnValue.Name;
            }

            if (returnValue.IsFirstTimeLoggedIn && returnValue.UserType != 1)
            {
                Response.Redirect("~/Pages/Password/ForceChangePassword.aspx", true);
            }

            if (Session["CurrentPage"] != null)
            {
                Response.Redirect(Session["CurrentPage"].ToString());
            }
            else
            {
                Response.Redirect("Home.aspx", true);
            }
        }
Ejemplo n.º 2
0
        private void DoLogin(string username, string password)
        {
            // Block MSH from loggin into FED because it is too well known
            // Block rekoop integration user as well as it should only be using web services
            if (username.Trim().ToLower() == "msh" || username.Trim().ToLower() == "rekoop")
            {
                _lblError.Text = "Invalid logon details";
                return;
            }

            _logonService = new LogonServiceClient();
            LogonReturnValue returnValue;

            returnValue = _logonService.Logon(username, password);

            if (!returnValue.Success)
            {
                _lblError.Text = returnValue.Message;
                return;
            }

            Session[SessionName.LogonName] = username;

            Session["LogonID"] = returnValue.LogonId;

            if (null == Session[SessionName.ControlSettings])
                PopulateControlPermissions(returnValue.UserType);

            Session[SessionName.LogonSettings] = returnValue;

            if (!string.IsNullOrEmpty(returnValue.WebStyleSheet))
            {
                // This session is used for all kind of operation being done on CSS files
                Session[SessionName.StyleSheet] = returnValue.WebStyleSheet;

                // This session is used for security purpose
                // for instance, if user change the CSS contents, then on click of preview button of ChangeStyle.aspx screen
                // the new temperory CSS file is created and this CSS is set to Session[SessionName.StyleSheet]
                // and if user wants to cancel the operation, the Session[SessionName.UserStyleSheet] will set to Session[SessionName.StyleSheet]
                Session[SessionName.UserStyleSheet] = returnValue.WebStyleSheet;
            }

            if (returnValue.UserType == 2)
            {
                _clientService = new ClientServiceClient();
                bool isMember = true;
                Guid memOrOrgId = Guid.Empty;

                if (returnValue.MemberId == IRIS.Law.WebApp.App_Code.DataConstants.DummyGuid)
                {
                    memOrOrgId = returnValue.OrganisationId;
                    isMember = false;
                }
                else
                {
                    memOrOrgId = returnValue.MemberId;
                }

                ClientDetailReturnValue _clientReturnValue = _clientService.GetClientDetail(returnValue.LogonId, memOrOrgId,
                                                                                            isMember);

                Session[SessionName.MemberId] = returnValue.MemberId;
                Session[SessionName.OrganisationId] = returnValue.OrganisationId;
                Session[SessionName.ClientRef] = _clientReturnValue.ClientReference;
                Session[SessionName.ClientName] = _clientReturnValue.Name;
            }

            if (returnValue.IsFirstTimeLoggedIn && returnValue.UserType != 1)
            {
                Response.Redirect("~/Pages/Password/ForceChangePassword.aspx", true);
            }

            if (Session["CurrentPage"] != null)
            {
                Response.Redirect(Session["CurrentPage"].ToString());
            }
            else
            {
                Response.Redirect("Home.aspx", true);
            }
        }