Beispiel #1
0
        //private void BindRoles(AccountsPrincipal user)
        //{
        //    if (user.Permissions.Count > 0)
        //    {
        //        RoleList.Visible = true;
        //        ArrayList Permissions = user.Permissions;
        //        RoleList.Text = "权限列表:<ul>";
        //        for (int i = 0; i < Permissions.Count; i++)
        //        {
        //            RoleList.Text += "<li>" + Permissions[i] + "</li>";
        //        }
        //        RoleList.Text += "</ul>";
        //    }
        //}
        protected void btnSave_Click(object sender, System.EventArgs e)
        {
            if (Page.IsValid)
            {
                string username = this.lblName.Text.Trim();
                AccountsPrincipal user = new AccountsPrincipal(username);
                User currentUser = new Maticsoft.Accounts.Bus.User(user);
                currentUser.UserName = username;
                currentUser.TrueName = txtTrueName.Text.Trim();
                //if (RadioButton1.Checked)
                //    currentUser.Sex = "1";
                //else
                //    currentUser.Sex = "0";
                //currentUser.Phone = this.txtPhone.Text.Trim();
                currentUser.Email = txtEmail.Text.Trim();
                //currentUser.UserType = dropUserType.SelectedValue;
                //int style = int.Parse(this.dropStyle.SelectedValue);
                //currentUser.Style = style;
                if (!currentUser.Update())
                {
                    this.lblMsg.ForeColor = Color.Red;
                    this.lblMsg.Text = Resources.Site.TooltipUpdateError;
                }
                else
                {
                    this.lblMsg.ForeColor = Color.Blue;
                    this.lblMsg.Text = Resources.Site.TooltipSaveOK;
                }

            }
        }
Beispiel #2
0
        protected void btnSave_Click(object sender, System.EventArgs e)
        {
            string username = this.lblName.Text.Trim();
            AccountsPrincipal user = new AccountsPrincipal(username);
            User currentUser = new Maticsoft.Accounts.Bus.User(user);

            currentUser.UserName = username;
            currentUser.TrueName = txtTrueName.Text.Trim();
            if (txtPassword.Text.Trim() != "")
            {
                currentUser.Password = AccountsPrincipal.EncryptPassword(txtPassword.Text);
            }
            //if (RadioButton1.Checked)
            //    currentUser.Sex = "1";
            //else
            //    currentUser.Sex = "0";

            currentUser.UserType = dropUserType.SelectedValue;
            currentUser.Phone = this.txtPhone.Text.Trim();
            currentUser.Email = txtEmail.Text.Trim();
            if (txtEmployeeID.Text.Length > 0)
            {
                currentUser.EmployeeID = Convert.ToInt32(txtEmployeeID.Text);
            }
            else
            {
                currentUser.EmployeeID = -1;
            }
            currentUser.Activity = !chkActive.Checked;

            //int style = int.Parse(this.dropStyle.SelectedValue);
            //currentUser.Style = style;

            if (!currentUser.Update())
            {
                this.lblMsg.ForeColor = Color.Red;
                this.lblMsg.Text = Resources.Site.TooltipUpdateError;
            }
            else
            {
                Response.Redirect("useradmin.aspx");
            }
        }
Beispiel #3
0
        public void btnSave_Click(object sender, System.EventArgs e)
        {
            if (Page.IsValid)
            {
                SiteIdentity SID = new SiteIdentity(User.Identity.Name);
                if (SID.TestPassword(txtOldPassword.Text) == 0)
                {
                    this.lblMsg.ForeColor = Color.Red;
                    this.lblMsg.Text = "原密码输入错误!";
                }
                else
                    if (this.txtPassword.Text.Trim() != this.txtPassword1.Text.Trim())
                    {
                        this.lblMsg.ForeColor = Color.Red;
                        this.lblMsg.Text = "密码输入的不一致!请重试!";
                    }
                    else
                    {
                        AccountsPrincipal user = new AccountsPrincipal(Context.User.Identity.Name);
                        User currentUser = new Maticsoft.Accounts.Bus.User(user);

                        currentUser.Password = AccountsPrincipal.EncryptPassword(txtPassword.Text);

                        if (!currentUser.Update())
                        {
                            this.lblMsg.ForeColor = Color.Red;
                            this.lblMsg.Text = Resources.Site.TooltipUpdateError;
                            //日志
                            //UserLog.AddLog(currentUser.UserName, currentUser.UserType, Request.UserHostAddress, Request.Url.AbsoluteUri, "用户密码更新失败");
                        }
                        else
                        {
                            this.lblMsg.ForeColor = Color.Blue;
                            this.lblMsg.Text = Resources.Site.TooltipSaveOK;
                            //日志
                            //UserLog.AddLog(currentUser.UserName, currentUser.UserType, Request.UserHostAddress, Request.Url.AbsoluteUri, "用户密码更新成功");
                        }

                    }
            }
        }
Beispiel #4
0
 protected void btnSave_Click(object sender, EventArgs e)
 {
     if (this.Page.IsValid)
     {
         string userName = this.lblName.Text.Trim();
         AccountsPrincipal existingPrincipal = new AccountsPrincipal(userName);
         User user = new User(existingPrincipal) {
             UserName = userName,
             TrueName = this.txtTrueName.Text.Trim(),
             Email = this.txtEmail.Text.Trim()
         };
         if (!user.Update())
         {
             MessageBox.ShowFailTip(this, Site.TooltipUpdateError);
         }
         else
         {
             MessageBox.ShowSuccessTip(this, Site.TooltipSaveOK);
         }
     }
 }
Beispiel #5
0
 protected void btnSubmit_Click(object sender, EventArgs e)
 {
     //检测旧密码是否争取
     string uInput = this.txtOldpws.Value.Trim();
     AccountsPrincipal newUser = AccountsPrincipal.ValidateLogin(CurrentUser.UserName, uInput);
     if (newUser == null)
     {
         Common.MessageBox.ShowFailTip(this, "旧密码错误,请重新输入!");
         return;
     }
     string NewPwd = this.txtSurePwd.Value;
     AccountsPrincipal APUser = new AccountsPrincipal(Context.User.Identity.Name);
     User currentUser = new Maticsoft.Accounts.Bus.User(APUser);
     currentUser.Password = AccountsPrincipal.EncryptPassword(NewPwd);
     if (!currentUser.Update())
     {
         Maticsoft.Common.MessageBox.ShowFailTip(this, "'系统忙,请稍后再试!");
         return;
     }
     else
     {
         Maticsoft.Common.MessageBox.ShowSuccessTip(this, "密码修改成功!下次登录生效!");
     }
 }
Beispiel #6
0
 protected void gridView_RowCommand(object sender, GridViewCommandEventArgs e)
 {
     if ((e.CommandName == "Status") && (e.CommandArgument != null))
     {
         string[] strArray = e.CommandArgument.ToString().Split(new char[] { ',' });
         AccountsPrincipal existingPrincipal = new AccountsPrincipal(Globals.SafeInt(strArray[0], 0));
         User user = new User(existingPrincipal);
         bool flag = Globals.SafeBool(strArray[1], false);
         user.Activity = !flag;
         user.Update();
         this.gridView.OnBind();
     }
 }
 public void UpdateUserInfo(FormCollection collection)
 {
     JsonObject obj2 = new JsonObject();
     UsersExpModel usersModel = this.userEXBll.GetUsersModel(base.CurrentUser.UserID);
     usersModel.TelPhone = collection["TelPhone"];
     string str = collection["Birthday"];
     if (!string.IsNullOrWhiteSpace(str) && PageValidate.IsDateTime(str))
     {
         usersModel.Birthday = new DateTime?(Globals.SafeDateTime(str, DateTime.Now));
     }
     else
     {
         usersModel.Birthday = null;
     }
     usersModel.Constellation = collection["Constellation"];
     usersModel.PersonalStatus = collection["PersonalStatus"];
     usersModel.Singature = collection["Singature"];
     usersModel.Address = collection["Address"];
     User user = new User(base.CurrentUser.UserID) {
         Sex = collection["Sex"],
         Email = collection["Email"],
         NickName = collection["NickName"],
         Phone = collection["Phone"]
     };
     if (user.Update() && this.userEXBll.UpdateUsersExp(usersModel))
     {
         obj2.Accumulate("STATUS", "SUCC");
     }
     else
     {
         obj2.Accumulate("STATUS", "FAIL");
     }
     base.Response.Write(obj2.ToString());
 }
 public void UpdateUserInfo(FormCollection collection)
 {
     if ((!base.HttpContext.User.Identity.IsAuthenticated || (base.CurrentUser == null)) || (base.CurrentUser.UserType == "AA"))
     {
         this.RedirectToAction(((dynamic) base.ViewBag).BasePath + "Account/Login");
     }
     else
     {
         JsonObject obj2 = new JsonObject();
         UsersExpModel usersModel = this.userEXBll.GetUsersModel(base.CurrentUser.UserID);
         if (usersModel == null)
         {
             base.RedirectToAction("Login", "Account");
         }
         else
         {
             usersModel.TelPhone = collection["TelPhone"];
             string str = collection["Birthday"];
             if (!string.IsNullOrWhiteSpace(str) && PageValidate.IsDateTime(str))
             {
                 usersModel.Birthday = new DateTime?(Globals.SafeDateTime(str, DateTime.Now));
             }
             else
             {
                 usersModel.Birthday = null;
             }
             usersModel.Constellation = collection["Constellation"];
             usersModel.PersonalStatus = collection["PersonalStatus"];
             usersModel.Singature = collection["Singature"];
             usersModel.Address = collection["Address"];
             User user = new User(base.CurrentUser.UserID) {
                 Sex = collection["Sex"],
                 Email = collection["Email"],
                 NickName = collection["NickName"],
                 Phone = collection["Phone"]
             };
             if (user.Update() && this.userEXBll.UpdateUsersExp(usersModel))
             {
                 obj2.Accumulate("STATUS", "SUCC");
             }
             else
             {
                 obj2.Accumulate("STATUS", "FAIL");
             }
             base.Response.Write(obj2.ToString());
         }
     }
 }
 public ActionResult VerifyPassword(FormCollection collection)
 {
     if (string.IsNullOrWhiteSpace(collection["Email"]) || string.IsNullOrWhiteSpace(collection["NewPwd"]))
     {
         return base.View();
     }
     string userName = collection["Email"].Trim();
     string str2 = collection["NewPwd"];
     User user = new User(userName);
     if (string.IsNullOrWhiteSpace(str2))
     {
         base.ModelState.AddModelError("Error", "该用户不存在!");
         return base.View();
     }
     user.Password = AccountsPrincipal.EncryptPassword(PageValidate.InputText(str2, 30));
     if (!user.Update())
     {
         base.ModelState.AddModelError("Error", "密码重置失败,请检查输入的信息是否正确或者联系管理员!");
         return base.View();
     }
     AccountsPrincipal.ValidateLogin(userName, str2);
     FormsAuthentication.SetAuthCookie(userName, false);
     base.Session[Globals.SESSIONKEY_USER] = user;
     base.Session["Style"] = user.Style;
     new Maticsoft.BLL.Members.PointsDetail().AddPoints("Login", user.UserID, "登录操作", "");
     if (base.Session["returnPage"] != null)
     {
         string url = base.Session["returnPage"].ToString();
         base.Session["returnPage"] = null;
         return this.Redirect(url);
     }
     return base.RedirectToAction("Posts", "Profile");
 }