mirror of
https://github.com/PrismLauncher/PrismLauncher.git
synced 2026-06-29 01:54:20 +03:00
fix(MSADeviceCodeStep): show network request error message
Signed-off-by: Octol1ttle <l1ttleofficial@outlook.com>
This commit is contained in:
parent
bf8d1ca1f8
commit
81159fd9d7
1 changed files with 6 additions and 6 deletions
|
|
@ -113,6 +113,12 @@ DeviceAuthorizationResponse parseDeviceAuthorizationResponse(const QByteArray& d
|
||||||
|
|
||||||
void MSADeviceCodeStep::deviceAuthorizationFinished(QByteArray* response)
|
void MSADeviceCodeStep::deviceAuthorizationFinished(QByteArray* response)
|
||||||
{
|
{
|
||||||
|
if (!m_request->wasSuccessful() || m_request->error() != QNetworkReply::NoError) {
|
||||||
|
qWarning() << "Device authorization failed:" << m_request->error() << m_request->errorString();
|
||||||
|
emit finished(AccountTaskState::STATE_FAILED_HARD, tr("Device authorization failed: %1").arg(m_request->errorString()));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
auto rsp = parseDeviceAuthorizationResponse(*response);
|
auto rsp = parseDeviceAuthorizationResponse(*response);
|
||||||
if (!rsp.error.isEmpty() || !rsp.error_description.isEmpty()) {
|
if (!rsp.error.isEmpty() || !rsp.error_description.isEmpty()) {
|
||||||
qWarning() << "Device authorization failed:" << rsp.error;
|
qWarning() << "Device authorization failed:" << rsp.error;
|
||||||
|
|
@ -120,12 +126,6 @@ void MSADeviceCodeStep::deviceAuthorizationFinished(QByteArray* response)
|
||||||
tr("Device authorization failed: %1").arg(rsp.error_description.isEmpty() ? rsp.error : rsp.error_description));
|
tr("Device authorization failed: %1").arg(rsp.error_description.isEmpty() ? rsp.error : rsp.error_description));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!m_request->wasSuccessful() || m_request->error() != QNetworkReply::NoError) {
|
|
||||||
qWarning() << "Device authorization failed:" << *response;
|
|
||||||
emit finished(AccountTaskState::STATE_FAILED_HARD, tr("Failed to retrieve device authorization"));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (rsp.device_code.isEmpty() || rsp.user_code.isEmpty() || rsp.verification_uri.isEmpty() || rsp.expires_in == 0) {
|
if (rsp.device_code.isEmpty() || rsp.user_code.isEmpty() || rsp.verification_uri.isEmpty() || rsp.expires_in == 0) {
|
||||||
qWarning() << "Device authorization failed: required fields missing";
|
qWarning() << "Device authorization failed: required fields missing";
|
||||||
emit finished(AccountTaskState::STATE_FAILED_HARD, tr("Device authorization failed: required fields missing"));
|
emit finished(AccountTaskState::STATE_FAILED_HARD, tr("Device authorization failed: required fields missing"));
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue