Example #1
0
		protected void btnAdd_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 LTP.Accounts.Bus.User(user);
				
					currentUser.Password=AccountsPrincipal.EncryptPassword(txtPassword.Text);					

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

		
		}
Example #2
0
        protected void btnAdd_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="��������IJ�һ�£������ԣ�";
                }
                else
                {
                    AccountsPrincipal user=new AccountsPrincipal(Context.User.Identity.Name);
                    User currentUser=new LTP.Accounts.Bus.User(user);

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

                    if (!currentUser.Update())
                    {
                        this.lblMsg.ForeColor=Color.Red;
                        this.lblMsg.Text = "�����û���Ϣ��������";
                        //��־
                        UserLog.AddLog(currentUser.UserName, currentUser.UserType, Request.UserHostAddress, Request.Url.AbsoluteUri, "�û��������ʧ��");
                    }
                    else
                    {
                        this.lblMsg.ForeColor=Color.Blue;
                        this.lblMsg.Text = "�û���Ϣ���³ɹ���";
                        //��־
                        UserLog.AddLog(currentUser.UserName, currentUser.UserType, Request.UserHostAddress, Request.Url.AbsoluteUri, "�û�������³ɹ�");
                    }

                }
            }
        }