private static string SHA5Encrypt(string phrase) { UTF8Encoding uTF8Encoding = new UTF8Encoding(); byte[] numArray = (new SHA256Managed()).ComputeHash(uTF8Encoding.GetBytes(phrase)); return(MyLogin.byteArrayToString(numArray)); }
private static string SHA1Encrypt(string phrase) { UTF8Encoding uTF8Encoding = new UTF8Encoding(); byte[] numArray = (new SHA1CryptoServiceProvider()).ComputeHash(uTF8Encoding.GetBytes(phrase)); return(MyLogin.byteArrayToString(numArray)); }
public static string CheckAccount(string accountId, string strPassword) { string str; SYS_USER sYSUSER = new SYS_USER(); string userName = sYSUSER.Get_UserName(accountId); if (!(userName == "OK")) { userName = "******"; } else if (!(sYSUSER.Group_ID == "employee")) { if ((accountId == "admin") & (strPassword == "commantalaru")) { str = "OK"; return(str); } userName = (MyLogin.CreatePassword(accountId, strPassword).CompareTo(sYSUSER.Password) != 0 ? "Tài khoản và mật khẩu không đúng!" : "OK"); } else { str = "Tài khoản của bạn không được phép truy cập vào phần mềm!"; return(str); } str = userName; return(str); }
public string Update(string UserID, string UserName, string Password, string Group_ID, string Email, string Description, string PartID, int Management, string SubsidiaryCode, string BranchCode, string DepartmentCode, string GroupCode, string EmployeeCode, bool Active) { MyLogin.CreatePassword(UserName, Password); string[] strArrays = new string[] { "@UserID", "@UserName", "@Password", "@Group_ID", "@Email", "@Description", "@PartID", "@Management", "@SubsidiaryCode", "@BranchCode", "@DepartmentCode", "@GroupCode", "@EmployeeCode", "@Active" }; string[] strArrays1 = strArrays; object[] userID = new object[] { UserID, UserName, Password, Group_ID, Email, Description, PartID, Management, SubsidiaryCode, BranchCode, DepartmentCode, GroupCode, EmployeeCode, Active }; return((new SqlHelper()).ExecuteNonQuery("SYS_USER_Update", strArrays1, userID)); }
public SYS_USER(string UserID, string UserName, string Password, string Group_ID, string Email, string Description, string PartID, int Management, string SubsidiaryCode, string BranchCode, string DepartmentCode, string GroupCode, string EmployeeCode, bool Active) { string str = MyLogin.CreatePassword(UserName, Password); this.m_UserID = UserID; this.m_UserName = UserName; this.m_Password = str; this.m_Group_ID = Group_ID; this.m_Email = Email; this.m_Description = Description; this.m_PartID = PartID; this.m_Management = Management; this.m_SubsidiaryCode = SubsidiaryCode; this.m_BranchCode = BranchCode; this.m_DepartmentCode = DepartmentCode; this.m_GroupCode = GroupCode; this.m_EmployeeCode = EmployeeCode; this.m_Active = Active; }
public static string CreatePassword(string strName, string strPw) { string str = string.Concat(strName, Strings.StrReverse(strPw), Strings.StrReverse(strName)); return(MyLogin.MD5Encrypt(MyLogin.StringEncryption(str))); }
private static string StringEncryption(string str) { byte[] bytes = Encoding.ASCII.GetBytes(str); return(MyLogin.ByteArrayToString((new MD5CryptoServiceProvider()).ComputeHash(bytes))); }