|
|
|
@ -37,15 +37,16 @@ public partial class LoginWindow : Window |
|
|
|
|
private void ConfirmButton_Click(object sender, RoutedEventArgs e) |
|
|
|
|
{ |
|
|
|
|
#if DEBUG |
|
|
|
|
|
|
|
|
|
new MainWindow().Show(); |
|
|
|
|
this.Close(); |
|
|
|
|
|
|
|
|
|
#else |
|
|
|
|
string account = AccountTextBox.Text; |
|
|
|
|
string password = PasswordBox.Password; |
|
|
|
|
string passwordEnc = Common.GenerateMd5Hash(password); |
|
|
|
|
string passworddb = getPassword(account); |
|
|
|
|
string passworddbEnc = Common.GenerateMd5Hash(passworddb); |
|
|
|
|
if (string.IsNullOrEmpty(passworddb) || !passwordEnc.Equals(passworddbEnc)) |
|
|
|
|
if (string.IsNullOrEmpty(password) || !passworddb.Equals(passwordEnc)) |
|
|
|
|
{ |
|
|
|
|
MessageBox.Show(MultilingualHelper.getString("NoPassword")); |
|
|
|
|
return; |
|
|
|
@ -58,8 +59,9 @@ public partial class LoginWindow : Window |
|
|
|
|
|
|
|
|
|
private void savePassword() |
|
|
|
|
{ |
|
|
|
|
if (IsRemberPassword.IsChecked ?? false || "Admin".Equals(AccountTextBox.Text)) |
|
|
|
|
if (IsRemberPassword.IsChecked ?? false) |
|
|
|
|
{ |
|
|
|
|
if (!"admin".Equals(AccountTextBox.Text)){ |
|
|
|
|
Settings saveAccount = new Settings() |
|
|
|
|
{ |
|
|
|
|
Key = "SAVE_ACCOUNT", |
|
|
|
@ -75,6 +77,7 @@ public partial class LoginWindow : Window |
|
|
|
|
}; |
|
|
|
|
savePassword.insert(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
Settings saveAccount = new Settings() |
|
|
|
@ -96,7 +99,7 @@ public partial class LoginWindow : Window |
|
|
|
|
{ |
|
|
|
|
Key = "PERMISSIONS", |
|
|
|
|
ItemName = "权限", |
|
|
|
|
Value = PasswordBox.Password, |
|
|
|
|
Value = AccountTextBox.Text, |
|
|
|
|
}; |
|
|
|
|
PERMISSIONS.insert(); |
|
|
|
|
} |
|
|
|
@ -104,7 +107,7 @@ public partial class LoginWindow : Window |
|
|
|
|
private string getPassword(string userName) |
|
|
|
|
{ |
|
|
|
|
string password = string.Empty; |
|
|
|
|
string sql = $"SELECT USER_PASSWORD FROM USER WHERE USER_NAME='{userName}'"; |
|
|
|
|
string sql = $"SELECT USER_PASSWORD FROM USER WHERE USER_NAME='{userName}';"; |
|
|
|
|
DataTable dt = DataBaseHelper.ExecuteQuery(sql); |
|
|
|
|
if (dt != null && dt.Rows.Count > 0) |
|
|
|
|
{ |
|
|
|
|