예제 #1
0
        /// <summary>
        /// 重置密码
        /// </summary>
        /// <param name="userId"></param>
        public void PwdReset(string userId)
        {
            TSUser tsUser = tsUserDAO.Get(userId);

            try
            {
                string password = Encrypt.ConvertPwd(tsUser.userId, tsUser.userCode);
                tsUserDAO.ChangePwd(tsUser.userId, password);
                Message.success(context, "用户密码重置成功");
                loginSession.Log(tsUser.userName + "[" + tsUser.userId + "]用户密码重置成功");
            }
            catch (Exception e)
            {
                Message.error(context, "用户修改失败");
                loginSession.Log(e.Message);
            }
        }
예제 #2
0
        /// <summary>
        /// 修改当前用户密码
        /// </summary>
        /// <param name="oldPwd">旧密码</param>
        /// <param name="newPwd">新密码</param>
        public void ChangePwd(string oldPwd, string newPwd)
        {
            TSUserDAO tsUserDao = new TSUserDAO();
            TSUser    user      = tsUserDao.Get(loginUser.UserId);

            if (user.userPwd.Equals(Encrypt.ConvertPwd(user.userId, oldPwd)) == false)
            {
                Message.error(context, "旧密码输入错误");
                return;
            }

            user.userPwd = Encrypt.ConvertPwd(user.userId, newPwd);
            try
            {
                tsUserDao.ChangePwd(user.userId, user.userPwd);
                Message.success(context, "密码修改成功");
                loginUser.Log("密码修改成功");
            }
            catch (Exception e)
            {
                Message.error(context, "密码修改失败");
                loginUser.Log("密码修改失败,错误:" + e.Message);
            }
        }