| | |
| | | { |
| | | public static LoginUser CurrentUser { get; private set; } |
| | | |
| | | private static readonly Encryptor encryptor = new Encryptor("12345678123456781234567812345678", |
| | | "1234567812345678"); |
| | | private static readonly Encryptor encryptor = new Encryptor("aB3dE5fG7hI9jjK1lMnOpQrS2tUvWxYz", |
| | | "8Wq9RsT4vYx6ZuB1"); |
| | | |
| | | public string id { get; set; } |
| | | public string realName { get; set; } |
| | |
| | | RemoveCacheBin(); |
| | | return false; |
| | | } |
| | | |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | public static bool Login(string username, string password, bool rememberMe) |
| | | { |
| | | |
| | | ToolSetting setting = ToolSetting.Instance; |
| | | using (HttpClient client = new HttpClient |
| | | { |
| | | BaseAddress = new Uri("http://localhost:8888/pdm-web/"), |
| | | BaseAddress = new Uri($"http://{setting.Ip}:{setting.Port}/{setting.BaseUrl}/"), |
| | | }) |
| | | { |
| | | try |
| | |
| | | password = password, |
| | | appId = "sockettool", |
| | | pluginVersion = "0.0.0.1" |
| | | |
| | | }, "openApi/wpf/login"); |
| | | CurrentUser = res.HandleResult(); |
| | | CurrentUser.password = password; |
| | |
| | | catch (Exception ex) |
| | | { |
| | | RemoveCacheBin(); |
| | | throw ex; |
| | | } |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | |
| | | /// <summary> |
| | | /// 把明文密码加密后以二进制存入bin文件中 |
| | | /// TODO 使用机器码加密 |
| | | /// </summary> |
| | | /// <param name="content"></param> |
| | | public static void SaveStrToBin(string content) |
| | | { |
| | | string filePath = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().FullName), "bin"); |