using ComponentFactory.Krypton.Toolkit; using NXWMS.Client.Code.Security; using NXWMS.Client.Model.AppModels.Condition; using NXWMS.Client.Model.CoreModels; using NXWMS.Services; using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; namespace NXWMS { public partial class frmEditPassword : KryptonForm { public frmEditPassword() { InitializeComponent(); } private void kryptonButtonSave_Click(object sender, EventArgs e) { if (SecurityCryptography.GetMd5Hash(SecurityCryptography.GetMd5Hash(txtOldPS.Text)).ToLower() != AppConfig.EncryptionPs.ToLower()) { KryptonMessageBox.Show($"原密码错误,请检查!", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); return; } if (txtNewPS.Text != txtNewPS1.Text) { KryptonMessageBox.Show($"两次输入的新密码不一致,请检查!", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); return; } var result = SysSettingsServices.userService.UpdatePS(new UserCondition { UserId = AppConfig.UserLoginResult.UserInfo.UserId, Password = SecurityCryptography.GetMd5Hash(SecurityCryptography.GetMd5Hash(txtNewPS.Text)), OperationUserId = AppConfig.UserLoginResult.UserInfo.UserId, }); if (result.Status == OperateStatus.Success) { KryptonMessageBox.Show($"密码修改成功!", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); this.DialogResult = DialogResult.OK; } else { KryptonMessageBox.Show($"密码修改失败!"+ result.Message, "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); this.DialogResult = DialogResult.Cancel; } } } }