public static bool ResetPwd(int id, string newpwd) { bool result = DataAccessFactory.GetDataAccess().ExecuteSql("update table_users set c_pwd='" + SecurityFactory.GetSecurity().Encrypt(newpwd) + "' where id=" + id); if (result) { BusLog log = new BusLog(); log.BusType = "重设密码"; log.Content = "admin修改ID为" + id + "的密码"; BusLogOperator.InitByLoginUser(log); SimpleOrmOperator.Create(log); //log.Operator= } return(result); }
public static string ChangePwd(UserObject user, string oldpwd, string newpwd) { if (user.Password != SecurityFactory.GetSecurity().Encrypt(oldpwd)) { return("旧密码输入错误!"); } bool result = DataAccessFactory.GetDataAccess().ExecuteSql("update table_users set c_pwd='" + SecurityFactory.GetSecurity().Encrypt(newpwd) + "' where id=" + user.Id); if (result) { BusLog log = new BusLog(); log.BusType = "修改密码"; log.Content = user.FullName + "修改自己的密码"; BusLogOperator.InitByLoginUser(log); //log.Operator= return(string.Empty); } else { return("修改密码失败!"); } }