客户端中追加账户记录有效期,七天不登陆自动清空填写
This commit is contained in:
@@ -89,6 +89,11 @@ namespace CommonLibrary
|
|||||||
/// 上次系统登录的密码
|
/// 上次系统登录的密码
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string Password { get; set; } = "";
|
public string Password { get; set; } = "";
|
||||||
|
/// <summary>
|
||||||
|
/// 上次系统登录的时间
|
||||||
|
/// </summary>
|
||||||
|
public DateTime LoginTime { get; set; } = DateTime.Now;
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 当前计算机的机器码,用来判定参数是否是正确的
|
/// 当前计算机的机器码,用来判定参数是否是正确的
|
||||||
@@ -107,6 +112,7 @@ namespace CommonLibrary
|
|||||||
json.Add(nameof(Password), new JValue(Password));
|
json.Add(nameof(Password), new JValue(Password));
|
||||||
json.Add(nameof(IsNewVersionRunning), new JValue(IsNewVersionRunning));
|
json.Add(nameof(IsNewVersionRunning), new JValue(IsNewVersionRunning));
|
||||||
json.Add(nameof(SystemInfo), new JValue(SystemInfo));
|
json.Add(nameof(SystemInfo), new JValue(SystemInfo));
|
||||||
|
json.Add(nameof(LoginTime), new JValue(LoginTime));
|
||||||
return json.ToString();
|
return json.ToString();
|
||||||
}
|
}
|
||||||
public override void LoadByString(string content)
|
public override void LoadByString(string content)
|
||||||
@@ -119,6 +125,7 @@ namespace CommonLibrary
|
|||||||
LoginName = SoftBasic.GetValueFromJsonObject(json, nameof(LoginName), LoginName);
|
LoginName = SoftBasic.GetValueFromJsonObject(json, nameof(LoginName), LoginName);
|
||||||
IsNewVersionRunning = SoftBasic.GetValueFromJsonObject(json, nameof(IsNewVersionRunning), IsNewVersionRunning);
|
IsNewVersionRunning = SoftBasic.GetValueFromJsonObject(json, nameof(IsNewVersionRunning), IsNewVersionRunning);
|
||||||
Password = SoftBasic.GetValueFromJsonObject(json, nameof(Password), Password);
|
Password = SoftBasic.GetValueFromJsonObject(json, nameof(Password), Password);
|
||||||
|
LoginTime = SoftBasic.GetValueFromJsonObject(json, nameof(LoginTime), LoginTime);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -49,11 +49,14 @@ namespace 软件系统客户端模版
|
|||||||
{
|
{
|
||||||
IsWindowShow = true;
|
IsWindowShow = true;
|
||||||
|
|
||||||
//加载数据
|
//如果七天未登录,账户密码清除
|
||||||
textBox_userName.Text = UserClient.JsonSettings.LoginName ?? "";
|
if ((DateTime.Now - UserClient.JsonSettings.LoginTime).TotalDays < 7)
|
||||||
textBox_password.Text = UserClient.JsonSettings.Password ?? "";
|
{
|
||||||
checkBox_remeber.Checked = UserClient.JsonSettings.Password != "";
|
//加载数据
|
||||||
|
textBox_userName.Text = UserClient.JsonSettings.LoginName ?? "";
|
||||||
|
textBox_password.Text = UserClient.JsonSettings.Password ?? "";
|
||||||
|
checkBox_remeber.Checked = UserClient.JsonSettings.Password != "";
|
||||||
|
}
|
||||||
//初始化输入焦点
|
//初始化输入焦点
|
||||||
if (UserClient.JsonSettings.Password != "") userButton_login.Focus();
|
if (UserClient.JsonSettings.Password != "") userButton_login.Focus();
|
||||||
else if (UserClient.JsonSettings.LoginName != "") textBox_password.Focus();
|
else if (UserClient.JsonSettings.LoginName != "") textBox_password.Focus();
|
||||||
@@ -230,6 +233,7 @@ namespace 软件系统客户端模版
|
|||||||
//登录成功,进行保存用户名称和密码
|
//登录成功,进行保存用户名称和密码
|
||||||
UserClient.JsonSettings.LoginName = textBox_userName.Text;
|
UserClient.JsonSettings.LoginName = textBox_userName.Text;
|
||||||
UserClient.JsonSettings.Password = checkBox_remeber.Checked ? textBox_password.Text : "";
|
UserClient.JsonSettings.Password = checkBox_remeber.Checked ? textBox_password.Text : "";
|
||||||
|
UserClient.JsonSettings.LoginTime = DateTime.Now;
|
||||||
UserClient.JsonSettings.SaveToFile();
|
UserClient.JsonSettings.SaveToFile();
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user