基线:全量源码首提(D1 版本控制落地,含第一轮优化 B1-B4/A1/A4/缩放修复)
This commit is contained in:
@@ -0,0 +1,68 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Windows.Forms;
|
||||
using System.Web.Script.Serialization;
|
||||
|
||||
namespace 成套报价软件
|
||||
{
|
||||
/// <summary>修改密码对话框:调会员服务改密(校验旧密码)。</summary>
|
||||
public partial class 修改密码 : Form
|
||||
{
|
||||
public 修改密码()
|
||||
{
|
||||
InitializeComponent();
|
||||
this.BackColor = System.Drawing.Color.White;
|
||||
}
|
||||
|
||||
private void btn确认_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (txt新密码.Text != txt确认新密码.Text)
|
||||
{
|
||||
MessageBox.Show(this, "两次输入的新密码不一致。", "修改密码",
|
||||
MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
if (!会员服务Host.EnsureRunning())
|
||||
{
|
||||
MessageBox.Show(this, "会员服务连接失败,请检查服务器地址与网络。", "修改密码",
|
||||
MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
string json = new JavaScriptSerializer().Serialize(new Dictionary<string, string>
|
||||
{
|
||||
{ "手机号", txt手机号码.Text.Trim() },
|
||||
{ "旧密码", txt旧密码.Text },
|
||||
{ "新密码", txt新密码.Text }
|
||||
});
|
||||
var resp = new JavaScriptSerializer()
|
||||
.Deserialize<Dictionary<string, object>>(会员服务Host.Post("/api/changepwd", json));
|
||||
bool ok = resp.ContainsKey("ok") && Convert.ToBoolean(resp["ok"]);
|
||||
if (ok)
|
||||
{
|
||||
// ★改密成功=立即退出登录(用户 2026-09-26 要求):清空内存登录态,
|
||||
// 由主窗口紧接着弹登录窗让客户用新密码重新登录
|
||||
MainForm.当前登录手机号 = "";
|
||||
MainForm.当前登录密码 = "";
|
||||
MainForm.当前会员类型 = "";
|
||||
MainForm.当前有效期 = "";
|
||||
MessageBox.Show(this, "密码修改成功,请用新密码重新登录。", "修改密码",
|
||||
MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
DialogResult = DialogResult.OK;
|
||||
Close();
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox.Show(this, "修改失败: " + (resp.ContainsKey("msg") ? Convert.ToString(resp["msg"]) : "未知错误"),
|
||||
"修改密码", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(this, "修改密码异常: " + ex.Message, "修改密码",
|
||||
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user