private void CheckCurrentPwd() { BLL.UserBLL bll = new BLL.UserBLL(); string pwd = ReStr("OldPwd"); string UserId = bll.CurrentUserId(); if (bll.CheckUserIdAndPwd(UserId, pwd)) { //用户密码正确! ReTrue(); } else { //用户密码错误! throw new Exception("密码输入错误!"); } }
private void ChangePwd() { BLL.UserBLL bll = new BLL.UserBLL(); string OldPwd = ReStr("OldPwd"); string NewPwd1 = ReStr("NewPwd1"); string NewPwd2 = ReStr("NewPwd2"); string UserId = bll.CurrentUserId(); if (!bll.CheckUserIdAndPwd(UserId, OldPwd)) { throw new Exception("原始密码与当前用户不符!"); } if (NewPwd1.Trim() != NewPwd2.Trim()) { throw new Exception("输入了两次不同的新密码!"); } bll.ChangePwd(UserId, NewPwd1); bll.LoginIn(UserId, NewPwd1); ReTrue(); }