コード例 #1
0
ファイル: StringsTest.cs プロジェクト: EinsteinSu/EsuCommon
 public void GetPassword()
 {
     string data = "VjMgLJhGdw0=";
       var security = new StringSecurity();
       var password = security.DecryptString(data);
       Console.WriteLine(password);
 }
コード例 #2
0
 public User Login(string userName, string password)
 {
   const string sql =
     "select guid, username, email from hrcommon.dbo.enterpriseusers where username = @username and password = @password";
   string encryptPassword = new StringSecurity().EncryptString(password);
   var parameters = new IDataParameter[2];
   parameters[0] = new SqlParameter("@username", userName);
   parameters[1] = new SqlParameter("@password", encryptPassword);
   return ReadSingleRecord(sql, new UserCreator(), parameters);
 }
コード例 #3
0
 public string PasswordChange(string userID, string password)
 {
   try
   {
     const string sql = "Update hrcommon.dbo.enterpriseusers set password = @password where guid = @id";
     string encryptPassword = new StringSecurity().EncryptString(password);
     var parameters = new IDataParameter[2];
     parameters[0] = new SqlParameter("@id", userID);
     parameters[1] = new SqlParameter("@password", encryptPassword);
     Execute(sql, parameters);
     return "密码修改成功!";
   }
   catch (Exception ex)
   {
     return "密码修改失败:" + ex.Message;
   }
 }