Esempio n. 1
0
 public void btnSave_Click(object sender, EventArgs e)
 {
     if (this.Page.IsValid)
     {
         SiteIdentity identity = new SiteIdentity(base.User.Identity.Name);
         if (identity.TestPassword(this.txtOldPassword.Text) == 0)
         {
             this.lblMsg.ForeColor = Color.Red;
             this.lblMsg.Text = Site.ErrorPasswprdError;
         }
         else if (this.txtPassword.Text.Trim() != this.txtPassword1.Text.Trim())
         {
             this.lblMsg.ForeColor = Color.Red;
             this.lblMsg.Text = Site.ErrorPasswprd;
         }
         else
         {
             User currentUser = base.CurrentUser;
             currentUser.Password = AccountsPrincipal.EncryptPassword(this.txtPassword.Text);
             if (!currentUser.Update())
             {
                 MessageBox.ShowFailTip(this, Site.TooltipUpdateError);
             }
             else
             {
                 MessageBox.ShowSuccessTip(this, Site.TooltipSaveOK);
             }
         }
     }
 }
Esempio n. 2
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, "用户密码更新成功");
                        }

                    }
            }
        }
 public void CheckPassword(FormCollection collection)
 {
     JsonObject obj2 = new JsonObject();
     string str = collection["Password"];
     if (!string.IsNullOrWhiteSpace(str))
     {
         SiteIdentity identity = new SiteIdentity(base.CurrentUser.UserName);
         if (identity.TestPassword(str.Trim()) == 0)
         {
             obj2.Accumulate("STATUS", "ERROR");
         }
         else
         {
             obj2.Accumulate("STATUS", "OK");
         }
     }
     else
     {
         obj2.Accumulate("STATUS", "UNDEFINED");
     }
     base.Response.Write(obj2.ToString());
 }
 public void CheckPassword(FormCollection collection)
 {
     if (!base.HttpContext.User.Identity.IsAuthenticated || (base.CurrentUser == null))
     {
         this.RedirectToAction(((dynamic) base.ViewBag).BasePath + "Account/Login");
     }
     else
     {
         JsonObject obj2 = new JsonObject();
         string str = collection["Password"];
         if (!string.IsNullOrWhiteSpace(str))
         {
             SiteIdentity identity = new SiteIdentity(base.CurrentUser.UserName);
             if (identity.TestPassword(str.Trim()) == 0)
             {
                 obj2.Accumulate("STATUS", "ERROR");
             }
             else
             {
                 obj2.Accumulate("STATUS", "OK");
             }
         }
         else
         {
             obj2.Accumulate("STATUS", "UNDEFINED");
         }
         base.Response.Write(obj2.ToString());
     }
 }