From 705909e14fe4e9f2fc261ee4eb40a8b41fa2f6d4 Mon Sep 17 00:00:00 2001 From: wzp <2880584989@qq.com> Date: 星期二, 12 七月 2022 17:37:26 +0800 Subject: [PATCH] 增加免密登陆的token --- web/web/Bin/Dao.dll | 0 web/UMCLib/bin/Debug/UMCLib.pdb | 0 web/web/Bin/App_Code.dll | 0 web/web/Bin/UMCLib.pdb | 0 web/App_Code/bin/Debug/App_Code.pdb | 0 web/web/Bin/Common.pdb | 0 web/Lib/Common.dll | 0 web/Lib/Model.pdb | 0 web/Lib/Dao.dll | 0 web/web/GwClient.ashx | 3 + web/Lib/Common.pdb | 0 web/App_Code/bin/Debug/App_Code.dll | 0 web/web/Bin/Common.dll | 0 web/web/Bin/Model.pdb | 0 web/web/Bin/UMCLib.dll | 0 web/.vs/Web/v16/.suo | 0 web/Lib/Model.dll | 0 web/UMCLib/bin/Debug/UMCLib.dll | 0 web/web/Bin/App_Code.pdb | 0 web/Common/DESEncrypt.cs | 88 ++++++++++++++++++++++---------------------- web/web/Bin/Model.dll | 0 web/.vs/Web/config/applicationhost.config | 2 web/Lib/Dao.pdb | 0 web/web/Bin/Dao.pdb | 0 24 files changed, 47 insertions(+), 46 deletions(-) diff --git a/web/.vs/Web/config/applicationhost.config b/web/.vs/Web/config/applicationhost.config index 69793a8..88fe2ce 100644 --- a/web/.vs/Web/config/applicationhost.config +++ b/web/.vs/Web/config/applicationhost.config @@ -162,7 +162,7 @@ </site> <site name="web" id="2"> <application path="/" applicationPool="Clr4IntegratedAppPool"> - <virtualDirectory path="/" physicalPath="C:\AYZH\work\Git_Rep\SMGW_NewWeb\web\web" /> + <virtualDirectory path="/" physicalPath="C:\Users\mac\Desktop\Work-Archives\SMGW\SMGW_NewWeb\web\web" /> </application> <bindings> <binding protocol="http" bindingInformation="*:60960:localhost" /> diff --git a/web/.vs/Web/v16/.suo b/web/.vs/Web/v16/.suo index 3e41c46..f911073 100644 --- a/web/.vs/Web/v16/.suo +++ b/web/.vs/Web/v16/.suo Binary files differ diff --git a/web/App_Code/bin/Debug/App_Code.dll b/web/App_Code/bin/Debug/App_Code.dll index 3a98e52..a02617a 100644 --- a/web/App_Code/bin/Debug/App_Code.dll +++ b/web/App_Code/bin/Debug/App_Code.dll Binary files differ diff --git a/web/App_Code/bin/Debug/App_Code.pdb b/web/App_Code/bin/Debug/App_Code.pdb index bde19c4..015ea52 100644 --- a/web/App_Code/bin/Debug/App_Code.pdb +++ b/web/App_Code/bin/Debug/App_Code.pdb Binary files differ diff --git a/web/Common/DESEncrypt.cs b/web/Common/DESEncrypt.cs index a1842d9..3582b13 100644 --- a/web/Common/DESEncrypt.cs +++ b/web/Common/DESEncrypt.cs @@ -7,57 +7,57 @@ namespace Common { - public class DESEncrypt - { + public class DESEncrypt + { //鍔犲瘑涓� //public static string encryptStr = "litianping"; public static string encryptStr = "abcDEF123@$@"; public static string Encrypt(string Text) - { - return DESEncrypt.Encrypt(Text, encryptStr ); - } - - public static string Encrypt(string Text, string sKey) - { - DESCryptoServiceProvider cryptoServiceProvider = new DESCryptoServiceProvider(); - byte[] bytes = Encoding.Default.GetBytes(Text); - //c#鐨凞ES鍔犲瘑鏄痥ey涓�8浣� - cryptoServiceProvider.Key = Encoding.ASCII.GetBytes(FormsAuthentication.HashPasswordForStoringInConfigFile(sKey, "md5").Substring(0, 8)); - cryptoServiceProvider.IV = Encoding.ASCII.GetBytes(FormsAuthentication.HashPasswordForStoringInConfigFile(sKey, "md5").Substring(0, 8)); - MemoryStream memoryStream = new MemoryStream(); - CryptoStream cryptoStream = new CryptoStream((Stream) memoryStream, cryptoServiceProvider.CreateEncryptor(), CryptoStreamMode.Write); - cryptoStream.Write(bytes, 0, bytes.Length); - cryptoStream.FlushFinalBlock(); - StringBuilder stringBuilder = new StringBuilder(); - foreach (byte num in memoryStream.ToArray()) - stringBuilder.AppendFormat("{0:X2}", (object) num); - return stringBuilder.ToString(); - } - - public static string Decrypt(string Text) - { - return DESEncrypt.Decrypt(Text, encryptStr); - } - - public static string Decrypt(string Text, string sKey) - { - DESCryptoServiceProvider cryptoServiceProvider = new DESCryptoServiceProvider(); - int length = Text.Length / 2; - byte[] buffer = new byte[length]; - for (int index = 0; index < length; ++index) - { - int num = Convert.ToInt32(Text.Substring(index * 2, 2), 16); - buffer[index] = (byte) num; + { + return DESEncrypt.Encrypt(Text, encryptStr); } + + public static string Encrypt(string Text, string sKey) + { + DESCryptoServiceProvider cryptoServiceProvider = new DESCryptoServiceProvider(); + byte[] bytes = Encoding.Default.GetBytes(Text); //c#鐨凞ES鍔犲瘑鏄痥ey涓�8浣� cryptoServiceProvider.Key = Encoding.ASCII.GetBytes(FormsAuthentication.HashPasswordForStoringInConfigFile(sKey, "md5").Substring(0, 8)); - cryptoServiceProvider.IV = Encoding.ASCII.GetBytes(FormsAuthentication.HashPasswordForStoringInConfigFile(sKey, "md5").Substring(0, 8)); - MemoryStream memoryStream = new MemoryStream(); - CryptoStream cryptoStream = new CryptoStream((Stream) memoryStream, cryptoServiceProvider.CreateDecryptor(), CryptoStreamMode.Write); - cryptoStream.Write(buffer, 0, buffer.Length); - cryptoStream.FlushFinalBlock(); - return Encoding.Default.GetString(memoryStream.ToArray()); + cryptoServiceProvider.IV = Encoding.ASCII.GetBytes(FormsAuthentication.HashPasswordForStoringInConfigFile(sKey, "md5").Substring(0, 8)); + MemoryStream memoryStream = new MemoryStream(); + CryptoStream cryptoStream = new CryptoStream((Stream)memoryStream, cryptoServiceProvider.CreateEncryptor(), CryptoStreamMode.Write); + cryptoStream.Write(bytes, 0, bytes.Length); + cryptoStream.FlushFinalBlock(); + StringBuilder stringBuilder = new StringBuilder(); + foreach (byte num in memoryStream.ToArray()) + stringBuilder.AppendFormat("{0:X2}", (object)num); + return stringBuilder.ToString(); + } + + public static string Decrypt(string Text) + { + return DESEncrypt.Decrypt(Text, encryptStr); + } + + public static string Decrypt(string Text, string sKey) + { + DESCryptoServiceProvider cryptoServiceProvider = new DESCryptoServiceProvider(); + int length = Text.Length / 2; + byte[] buffer = new byte[length]; + for (int index = 0; index < length; ++index) + { + int num = Convert.ToInt32(Text.Substring(index * 2, 2), 16); + buffer[index] = (byte)num; + } + //c#鐨凞ES鍔犲瘑鏄痥ey涓�8浣� + cryptoServiceProvider.Key = Encoding.ASCII.GetBytes(FormsAuthentication.HashPasswordForStoringInConfigFile(sKey, "md5").Substring(0, 8)); + cryptoServiceProvider.IV = Encoding.ASCII.GetBytes(FormsAuthentication.HashPasswordForStoringInConfigFile(sKey, "md5").Substring(0, 8)); + MemoryStream memoryStream = new MemoryStream(); + CryptoStream cryptoStream = new CryptoStream((Stream)memoryStream, cryptoServiceProvider.CreateDecryptor(), CryptoStreamMode.Write); + cryptoStream.Write(buffer, 0, buffer.Length); + cryptoStream.FlushFinalBlock(); + return Encoding.Default.GetString(memoryStream.ToArray()); + } } - } } diff --git a/web/Lib/Common.dll b/web/Lib/Common.dll index 36167d1..361c7d2 100644 --- a/web/Lib/Common.dll +++ b/web/Lib/Common.dll Binary files differ diff --git a/web/Lib/Common.pdb b/web/Lib/Common.pdb index b543520..2a0f9a6 100644 --- a/web/Lib/Common.pdb +++ b/web/Lib/Common.pdb Binary files differ diff --git a/web/Lib/Dao.dll b/web/Lib/Dao.dll index 20e0c1e..1aa6c6d 100644 --- a/web/Lib/Dao.dll +++ b/web/Lib/Dao.dll Binary files differ diff --git a/web/Lib/Dao.pdb b/web/Lib/Dao.pdb index 18ac19b..2232ca0 100644 --- a/web/Lib/Dao.pdb +++ b/web/Lib/Dao.pdb Binary files differ diff --git a/web/Lib/Model.dll b/web/Lib/Model.dll index 946da12..c090599 100644 --- a/web/Lib/Model.dll +++ b/web/Lib/Model.dll Binary files differ diff --git a/web/Lib/Model.pdb b/web/Lib/Model.pdb index badf488..8c37feb 100644 --- a/web/Lib/Model.pdb +++ b/web/Lib/Model.pdb Binary files differ diff --git a/web/UMCLib/bin/Debug/UMCLib.dll b/web/UMCLib/bin/Debug/UMCLib.dll index 7d955aa..20b79d8 100644 --- a/web/UMCLib/bin/Debug/UMCLib.dll +++ b/web/UMCLib/bin/Debug/UMCLib.dll Binary files differ diff --git a/web/UMCLib/bin/Debug/UMCLib.pdb b/web/UMCLib/bin/Debug/UMCLib.pdb index 9b51360..d7fc5d0 100644 --- a/web/UMCLib/bin/Debug/UMCLib.pdb +++ b/web/UMCLib/bin/Debug/UMCLib.pdb Binary files differ diff --git a/web/web/Bin/App_Code.dll b/web/web/Bin/App_Code.dll index 3a98e52..a02617a 100644 --- a/web/web/Bin/App_Code.dll +++ b/web/web/Bin/App_Code.dll Binary files differ diff --git a/web/web/Bin/App_Code.pdb b/web/web/Bin/App_Code.pdb index bde19c4..015ea52 100644 --- a/web/web/Bin/App_Code.pdb +++ b/web/web/Bin/App_Code.pdb Binary files differ diff --git a/web/web/Bin/Common.dll b/web/web/Bin/Common.dll index 05e666c..361c7d2 100644 --- a/web/web/Bin/Common.dll +++ b/web/web/Bin/Common.dll Binary files differ diff --git a/web/web/Bin/Common.pdb b/web/web/Bin/Common.pdb index 7272b90..2a0f9a6 100644 --- a/web/web/Bin/Common.pdb +++ b/web/web/Bin/Common.pdb Binary files differ diff --git a/web/web/Bin/Dao.dll b/web/web/Bin/Dao.dll index 13127c0..1aa6c6d 100644 --- a/web/web/Bin/Dao.dll +++ b/web/web/Bin/Dao.dll Binary files differ diff --git a/web/web/Bin/Dao.pdb b/web/web/Bin/Dao.pdb index 5e757c6..2232ca0 100644 --- a/web/web/Bin/Dao.pdb +++ b/web/web/Bin/Dao.pdb Binary files differ diff --git a/web/web/Bin/Model.dll b/web/web/Bin/Model.dll index 6982816..c090599 100644 --- a/web/web/Bin/Model.dll +++ b/web/web/Bin/Model.dll Binary files differ diff --git a/web/web/Bin/Model.pdb b/web/web/Bin/Model.pdb index 1ac6c1b..8c37feb 100644 --- a/web/web/Bin/Model.pdb +++ b/web/web/Bin/Model.pdb Binary files differ diff --git a/web/web/Bin/UMCLib.dll b/web/web/Bin/UMCLib.dll index 7d955aa..20b79d8 100644 --- a/web/web/Bin/UMCLib.dll +++ b/web/web/Bin/UMCLib.dll Binary files differ diff --git a/web/web/Bin/UMCLib.pdb b/web/web/Bin/UMCLib.pdb index 9b51360..d7fc5d0 100644 --- a/web/web/Bin/UMCLib.pdb +++ b/web/web/Bin/UMCLib.pdb Binary files differ diff --git a/web/web/GwClient.ashx b/web/web/GwClient.ashx index ccb85a6..d7bd4e7 100644 --- a/web/web/GwClient.ashx +++ b/web/web/GwClient.ashx @@ -145,7 +145,8 @@ if (item.Is_Enable == 1) { //string loginStr = "http://" + serverIp + ":" + clientPort + "/Attachedlogin.aspx?action=Attachedlogin&account=" + item.Account + "&password=" + item.Password; - string loginStr = "http://" + serverIp + ":" + clientPort + "/Attachedlogin.aspx?action=Attachedlogin&account=" + item.Account ; + string token = DESEncrypt.Encrypt(item.Password);//瀵圭О鍔犲瘑 + string loginStr = "http://" + serverIp + ":" + clientPort + "/Attachedlogin.aspx?action=Attachedlogin&account=" + item.Account+"&token="+token ; str += string.Format("<a class=\"action-modal-login btn btn-success btn-xs \" href=\"javascript:;\" data-url=\"{0}\" data-id=\"{1}\" target=\"_blank\">", (object)loginStr, (object)item.ClientID); str += " 鐧诲綍</a> "; -- Gitblit v1.9.1