예제 #1
0
        private string Login(int officeId, string userName, string password, string culture, bool rememberMe, string challenge, HttpContext context)
        {
            try
            {
                long signInId = Data.Office.User.SignIn(officeId, userName, password, culture, rememberMe, challenge, context);

                Log.Information("{UserName} signed in to office : #{OfficeId}.", userName, officeId);

                if (signInId > 0)
                {
                    MixERPWebpage.SetSession(this.Context.Session, signInId);
                    MixERPWebpage.SetAuthenticationTicket(this.Context.Response, signInId, rememberMe);

                    return("OK");
                }

                this.LogInvalidSignIn();
                return(Warnings.UserIdOrPasswordIncorrect);
            }
            catch (MixERPException ex)
            {
                Log.Warning("{UserName} could not sign in to office : #{OfficeId}.", userName, officeId);

                this.LogInvalidSignIn();
                return(ex.Message);
            }
        }
예제 #2
0
        private static bool Login(int officeId, string userName, string password, string culture, bool rememberMe, Page page)
        {
            bool results = Data.Office.User.SignIn(officeId, userName, password, culture, rememberMe, page);

            if (results)
            {
                MixERPWebpage.SetSession(page, userName);
                MixERPWebpage.SetAuthenticationTicket(page, userName, rememberMe);
            }

            return(results);
        }
예제 #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            this.CheckDbConnectivity();
            PageUtility.CheckInvalidAttempts(this.Page);

            try
            {
                this.BindBranchDropDownList();
            }
            catch
            {
                //Could not bind the branch office dropdownlist.
                //The target database does not contain mixerp schema.
                //Swallow the exception
                //and redirect to application offline page.
                this.RedirectToOfflinePage();
                return;
            }


            if (!this.IsPostBack)
            {
                if (this.User.Identity.IsAuthenticated)
                {
                    long signInId = Conversion.TryCastLong(this.User.Identity.Name);

                    if (signInId > 0)
                    {
                        string sessionUser = Conversion.TryCastString(this.Page.Session["UserName"]);

                        if (string.IsNullOrWhiteSpace(sessionUser))
                        {
                            if (MixERPWebpage.SetSession(this.Page.Session, signInId))
                            {
                                this.RedirectToDashboard();
                            }
                        }
                        else
                        {
                            this.RedirectToDashboard();
                        }
                    }
                }
            }
        }