fix(login): login2 补 checkCode=用户输入验证码 + codeId(修 checkCodeNotNull)

This commit is contained in:
gaozheng 2026-06-25 10:30:20 +08:00
parent 289b83cd35
commit ccd3040a67
1 changed files with 3 additions and 2 deletions

View File

@ -41,12 +41,13 @@ LoginLoad* AuthService::loginAsync(const QString& username, const QString& passw
}; };
// step2RSA 加密密码PKCS#1 v1.5 -> base64可抛 std::exception → ApiChain 转 failed-> login2。 // step2RSA 加密密码PKCS#1 v1.5 -> base64可抛 std::exception → ApiChain 转 failed-> login2。
ApiChain::StepFactory step2 = [this, username, password](const QList<ApiResponse>&) -> IApiCall* { ApiChain::StepFactory step2 = [this, username, password, code, codeId](const QList<ApiResponse>&) -> IApiCall* {
RsaEncryptor enc(rsaPublicKeyPem_); RsaEncryptor enc(rsaPublicKeyPem_);
const std::string encrypted = enc.encryptBase64(password.toStdString()); const std::string encrypted = enc.encryptBase64(password.toStdString());
const QJsonObject body{{QStringLiteral("username"), username}, const QJsonObject body{{QStringLiteral("username"), username},
{QStringLiteral("password"), QString::fromStdString(encrypted)}, {QStringLiteral("password"), QString::fromStdString(encrypted)},
{QStringLiteral("checkCode"), QString()}}; {QStringLiteral("checkCode"), code}, // 用户输入的验证码(后端 checkCodeNotNull
{QStringLiteral("codeId"), codeId}};
return api_.postJsonAsync(QString::fromLatin1(kPathLogin), body); return api_.postJsonAsync(QString::fromLatin1(kPathLogin), body);
}; };