@@ -58,6 +58,8 @@ void CustomLoginDialog::accept()
5858 return ;
5959 }
6060
61+ m_loginUrl = url;
62+
6163 setUserInputsEnabled (false );
6264 ui->progressBar ->setVisible (true );
6365
@@ -73,31 +75,28 @@ void CustomLoginDialog::onUrlResolving()
7375{
7476 disconnect (m_requestTask.get (), &Task::finished, this , &CustomLoginDialog::onUrlResolving);
7577
76- if (m_requestTask->error () != QNetworkReply::NoError) {
78+ if (m_requestTask->error () != QNetworkReply::NoError && m_requestTask-> replyStatusCode () != 405 ) {
7779 emit onTaskFailed (m_requestTask->errorString ());
7880 return ;
7981 }
8082
8183 // modify url if header say so
82- QUrl url;
8384 auto headers = m_requestTask->getRawHeaders ();
8485 if (const auto it =
8586 std::find_if (headers.begin (), headers.end (),
8687 [](const auto & pair) { return QString::fromUtf8 (pair.first ).toLower () == " x-authlib-injector-api-location" ; });
8788 it != headers.end ()) {
8889 const QUrl location = QString::fromUtf8 (it->second );
8990 if (location.isRelative ()) {
90- url = m_requestTask->url ().resolved (location);
91+ m_loginUrl = m_requestTask->url ().resolved (location);
9192 } else {
92- url = location;
93+ m_loginUrl = location;
9394 }
94- } else {
95- url = m_requestTask->url ();
9695 }
9796
9897 // Setup the login task and start it
99- m_account = CustomAccount::createCustom (ui->userTextBox ->text (), url .toString (QUrl::StripTrailingSlash), ui-> loginUrlTextBox -> text ( ),
100- ui->refreshUrlTextBox ->text ());
98+ m_account = CustomAccount::createCustom (ui->userTextBox ->text (), m_loginUrl .toString (QUrl::StripTrailingSlash),
99+ ui->loginUrlTextBox -> text (), ui-> refreshUrlTextBox ->text ());
101100 m_loginTask = m_account->login (ui->passTextBox ->text ());
102101 connect (m_loginTask.get (), &Task::failed, this , &CustomLoginDialog::onTaskFailed);
103102 connect (m_loginTask.get (), &Task::succeeded, this , &CustomLoginDialog::onTaskSucceeded);
0 commit comments