frmEditPassword.cs 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. using ComponentFactory.Krypton.Toolkit;
  2. using NXWMS.Client.Code.Security;
  3. using NXWMS.Client.Model.AppModels.Condition;
  4. using NXWMS.Client.Model.CoreModels;
  5. using NXWMS.Services;
  6. using System;
  7. using System.Collections.Generic;
  8. using System.ComponentModel;
  9. using System.Data;
  10. using System.Drawing;
  11. using System.Linq;
  12. using System.Text;
  13. using System.Windows.Forms;
  14. namespace NXWMS
  15. {
  16. public partial class frmEditPassword : KryptonForm
  17. {
  18. public frmEditPassword()
  19. {
  20. InitializeComponent();
  21. }
  22. private void kryptonButtonSave_Click(object sender, EventArgs e)
  23. {
  24. if (SecurityCryptography.GetMd5Hash(SecurityCryptography.GetMd5Hash(txtOldPS.Text)).ToLower() != AppConfig.EncryptionPs.ToLower())
  25. {
  26. KryptonMessageBox.Show($"原密码错误,请检查!", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
  27. return;
  28. }
  29. if (txtNewPS.Text != txtNewPS1.Text)
  30. {
  31. KryptonMessageBox.Show($"两次输入的新密码不一致,请检查!", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
  32. return;
  33. }
  34. var result = SysSettingsServices.userService.UpdatePS(new UserCondition
  35. {
  36. UserId = AppConfig.UserLoginResult.UserInfo.UserId,
  37. Password = SecurityCryptography.GetMd5Hash(SecurityCryptography.GetMd5Hash(txtNewPS.Text)),
  38. OperationUserId = AppConfig.UserLoginResult.UserInfo.UserId,
  39. });
  40. if (result.Status == OperateStatus.Success)
  41. {
  42. KryptonMessageBox.Show($"密码修改成功!", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
  43. this.DialogResult = DialogResult.OK;
  44. }
  45. else
  46. {
  47. KryptonMessageBox.Show($"密码修改失败!"+ result.Message, "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
  48. this.DialogResult = DialogResult.Cancel;
  49. }
  50. }
  51. }
  52. }