Example #1
0
 protected void Page_Load(object sender, System.EventArgs e)
 {
     Hidistro.Membership.Core.IUser user = Hidistro.Membership.Context.HiContext.Current.User;
     if (user.IsInRole("供应商") || user.IsInRole("区域发货点"))
     {
         this.Page.Response.Redirect(Globals.GetAdminAbsolutePath("/Login.aspx"));
     }
     this.litMessage.Text = string.Format("您登录的管理员帐号 “{0}” 没有权限访问当前页面或进行当前操作", Hidistro.Membership.Context.HiContext.Current.User.Username);
 }
Example #2
0
 protected void Page_Load(object sender, System.EventArgs e)
 {
     if (!string.IsNullOrEmpty(base.Request["isCallback"]) && base.Request["isCallback"] == "true")
     {
         string a   = base.Request["ctype"];
         string arg = "";
         if (a == "CheckRole")
         {
             if (!this.CheckRole())
             {
                 arg = "0";
             }
             else
             {
                 arg = "1";
             }
         }
         base.Response.Clear();
         base.Response.ContentType = "application/json";
         base.Response.Write("{ ");
         base.Response.Write(string.Format("\"flag\":\"{0}\"", arg));
         base.Response.Write("}");
         base.Response.End();
     }
     Hidistro.Membership.Core.IUser user = Hidistro.Membership.Context.HiContext.Current.User;
     if (!user.IsInRole("供应商"))
     {
         this.Page.Response.Redirect("login.aspx");
         return;
     }
     this.Page.Response.Redirect("default.html");
 }
Example #3
0
 private bool CheckRole()
 {
     Hidistro.Membership.Core.IUser user = Hidistro.Membership.Context.HiContext.Current.User;
     return(user.IsInRole("供应商"));
 }
Example #4
0
        private void btnAdminLogin_Click(object sender, System.EventArgs e)
        {
            if (!Hidistro.Membership.Context.HiContext.Current.CheckVerifyCode(this.txtCode.Text.Trim()))
            {
                this.ShowMessage("验证码不正确");
                return;
            }
            Hidistro.Membership.Core.IUser user = Hidistro.Membership.Context.Users.GetUser(0, this.txtAdminName.Text, false, true);
            if (user == null || user.IsAnonymous || user.UserRole != Hidistro.Membership.Core.Enums.UserRole.SiteManager || !user.IsInRole("区域发货点"))
            {
                this.ShowMessage("无效的用户信息");
                return;
            }
            string text = null;

            Hidistro.Membership.Context.SiteManager siteManager = user as Hidistro.Membership.Context.SiteManager;
            siteManager.Password = this.txtAdminPassWord.Text;
            Hidistro.Membership.Core.Enums.LoginUserStatus loginUserStatus = ManagerHelper.ValidLogin(siteManager);
            if (loginUserStatus == Hidistro.Membership.Core.Enums.LoginUserStatus.Success)
            {
                System.Web.HttpCookie authCookie = System.Web.Security.FormsAuthentication.GetAuthCookie(siteManager.Username, false);
                Hidistro.Membership.Core.IUserCookie userCookie = siteManager.GetUserCookie();
                userCookie.WriteCookie(authCookie, 30, false);
                Hidistro.Membership.Context.HiContext.Current.User = siteManager;
                if (!string.IsNullOrEmpty(this.Page.Request.QueryString["returnUrl"]))
                {
                    text = this.Page.Request.QueryString["returnUrl"];
                }
                if (text == null && this.ReferralLink != null && !string.IsNullOrEmpty(this.ReferralLink.Trim()))
                {
                    text = this.ReferralLink;
                }
                if (!string.IsNullOrEmpty(text) && (text.ToLower().IndexOf(Globals.GetSiteUrls().Logout.ToLower()) >= 0 || text.ToLower().IndexOf(Globals.GetSiteUrls().UrlData.FormatUrl("register").ToLower()) >= 0 || text.ToLower().IndexOf(Globals.GetSiteUrls().UrlData.FormatUrl("vote").ToLower()) >= 0 || text.ToLower().IndexOf("loginexit") >= 0))
                {
                }
                this.Page.Response.Redirect("default.html", true);
                return;
            }
            if (loginUserStatus == Hidistro.Membership.Core.Enums.LoginUserStatus.AccountPending)
            {
                this.ShowMessage("用户账号还没有通过审核");
                return;
            }
            if (loginUserStatus == Hidistro.Membership.Core.Enums.LoginUserStatus.AccountLockedOut)
            {
                this.ShowMessage("用户账号已被锁定,暂时不能登录系统");
                return;
            }
            if (loginUserStatus == Hidistro.Membership.Core.Enums.LoginUserStatus.InvalidCredentials)
            {
                this.ShowMessage("用户名或密码错误");
                return;
            }
            this.ShowMessage("登录失败,未知错误");
        }