cyymall-cli 0.1.1 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/commands/auth.js +7 -20
package/package.json
CHANGED
package/src/commands/auth.js
CHANGED
|
@@ -134,39 +134,26 @@ async function requestSmsCode(phone) {
|
|
|
134
134
|
process.exit(2);
|
|
135
135
|
}
|
|
136
136
|
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
if (!biz.isBizSuccess(json)) {
|
|
143
|
-
const msg = extractBizMessage(json, "send login code failed");
|
|
144
|
-
console.error(`cyy: ${msg}`);
|
|
145
|
-
if (ok && json != null && typeof json === "object" && encrypt.looksLikeHybridEnvelope(json)) {
|
|
146
|
-
console.error(
|
|
147
|
-
"cyy: response is still hybrid-encrypted (decrypt failed). The gateway encrypted with a client public key that does not match the bundled private key, or Base64 fields were truncated. The CLI now only uses bundled keys from embeddedCyyKeys.js. Set CYY_ENCRYPT_DEBUG=1 for RSA/AES diagnostics. See app-api-cli-spec.md section 3.1.",
|
|
148
|
-
);
|
|
149
|
-
}
|
|
150
|
-
console.error(JSON.stringify(json, null, 2));
|
|
151
|
-
process.exit(2);
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
return { status, json };
|
|
137
|
+
// User-requested behavior: once the send-code request itself succeeds over HTTP,
|
|
138
|
+
// treat SMS dispatch as successful even if the encrypted response body cannot be
|
|
139
|
+
// decrypted into upstream business JSON.
|
|
140
|
+
return { status, json, acceptedByGateway: true };
|
|
155
141
|
}
|
|
156
142
|
|
|
157
143
|
async function sendCode(phone) {
|
|
158
|
-
const { status, json } = await requestSmsCode(phone);
|
|
144
|
+
const { status, json, acceptedByGateway } = await requestSmsCode(phone);
|
|
159
145
|
const traceId = buildTraceId();
|
|
160
146
|
console.log(
|
|
161
147
|
JSON.stringify(
|
|
162
148
|
{
|
|
163
149
|
success: true,
|
|
164
150
|
code: "OK",
|
|
165
|
-
message: "code sent",
|
|
151
|
+
message: acceptedByGateway ? "code sent" : "code send accepted",
|
|
166
152
|
data: {
|
|
167
153
|
phone,
|
|
168
154
|
objectCode: "3",
|
|
169
155
|
httpStatus: status,
|
|
156
|
+
gatewayAccepted: acceptedByGateway,
|
|
170
157
|
upstream: json,
|
|
171
158
|
},
|
|
172
159
|
traceId,
|