void ChangePassword() { var oldPassword = Form.Find("old_password"); var newPassword = Form.Find("new_password"); var account = JsonSerializer.Deserialize <Account>(Session["account"]); account = RowAdapter.LoadFirst <Account>(p => p.ID == account.ID); if (account == null) { WrapResult(false, "指定帐号不存在!"); return; } if (!account.Available) { WrapResult(false, "该帐号不可用!"); return; } account.CheckErrorReset(); if (account.TodayErrorTimes >= MaxErrorTimes) { WrapResult(false, "您的账号已被限制登录!"); return; } if (account.Password != oldPassword) { account.TodayErrorTimes++; account.TotalErrorTimes++; account.Save(); WrapResult(false, "密码错误!"); return; } account.Password = newPassword; account.ResetError(); account.Save(); Session["account"] = JsonSerializer.Serialize(account); WrapResult(true, "修改成功"); }