public string Passworded(FormCollection form) { string oldPwd = form["txtOldPwd"] as string; string newPwd = form["txtNewPwd"] as string; string cifPwd = form["txtCifPwd"] as string; if (oldPwd == newPwd) { return("新密码不能与旧密码相同!"); } oldPwd = CryptoHelper.MD5(oldPwd, true); if (oldPwd != DawnauthHandler.UserInfo.UserPwd) { return("您输入的旧密码有误,请重新输入。"); } if (newPwd != cifPwd) { return("你输入的密码与确认密码不一致!"); } var stateInfo = GeneralHandler.StateSuccess; cifPwd = CryptoHelper.MD5(newPwd, true); DawnAuthUserBLL.Update(DawnauthHandler.UserId, cifPwd); return(stateInfo); }
/// <summary> /// 修改密码 /// </summary> /// <param name="userId">用户编号</param> /// <param name="userPwd">用户密码</param> public static void ChangePassword(int userId, string userPwd) { if (userId < 1 || string.IsNullOrEmpty(userPwd)) { return; } if (userPwd.Length != 32) { userPwd = CryptoHelper.MD5(userPwd, true); } DawnAuthUserBLL.Update(userId, userPwd); }
public string Reset(string id) { if (string.IsNullOrEmpty(id) || TypeHelper.TypeToInt32(id, -1) < 0) { return(GeneralHandler.FBaseInfo); } var stateInfo = GeneralHandler.StateSuccess; if (int.Parse(id) == DawnauthHandler.UserId) { stateInfo = "不可对当前登录管理员进行密码重置操作!"; } else { stateInfo = "Dawn"; stateInfo += CheckCodeHelper.GetEngAndNum(8); DawnAuthUserBLL.Update(int.Parse(id), CryptoHelper.MD5(stateInfo, true)); } return(stateInfo); }