设置密码MD5加密
作者:互联网
密码md5加密
public int setUserPassword(string UserCode, string OldPassword, string NewPassword) { if (string.IsNullOrEmpty(UserCode)) UserCode = App.getAppSession().CurrentUser.UserCode; var md5 = VStar.Utils.ConfigHelper.GetValue("~/config/db.config", "DBSettings", "com_" + App.getAppSession().ComName + "_md5"); string EnsOldPassword, EnsNewPassword; if (md5.ToString() == "simple" || string.IsNullOrEmpty(md5)) { //普通的md5加密 EnsOldPassword = VStar.Utils.MD5Encrypt.MD5Encoding(OldPassword); EnsNewPassword = VStar.Utils.MD5Encrypt.MD5Encoding(NewPassword); } else if ("none".Equals(md5)) { EnsOldPassword = OldPassword; EnsNewPassword = NewPassword; } else //带盐值复杂md5 { //md5加密,loginname为盐值 EnsOldPassword = VStar.Utils.MD5Encrypt.MD5Encoding(OldPassword, UserCode); EnsNewPassword = VStar.Utils.MD5Encrypt.MD5Encoding(NewPassword, UserCode); } System.Collections.Hashtable ht = new System.Collections.Hashtable(); ht.Add("UserCode", UserCode); ht.Add("OldPassword", EnsOldPassword); ht.Add("NewPassword", EnsNewPassword); int res = VstarApp.DAL.Service.CORE_Role_Service.Instance.Update("CORE_USERS_ChangePassword", ht); try { } catch (Exception) { } return res; }
标签:OldPassword,加密,string,UserCode,NewPassword,密码,EnsOldPassword,MD5,md5 来源: https://www.cnblogs.com/2021dayang/p/16192132.html