Since the default remote poll interval has been re-raised recently to 30 seconds,
the delay between clicking "Grant access" in the browser and fetch and showing success
in the wizard may seem erroneous to the users and tempt them to click "Re-open browser"
again, causing the whole login process to restart.
This commit implements an event handler to pass the wizard's window activation
event down to the Login Flow v2 page, in order to allow it to poll earlier.
Signed-off-by: Michael Schuster <michael@schuster.ms>
});
}
+void Flow2Auth::slotPollNow()
+{
+ // poll now if we're not already doing so
+ if(_pollTimer.isActive())
+ slotPollTimerTimeout();
+}
+
} // namespace OCC
* Job that does the authorization, grants and fetches the access token via Login Flow v2
*
* See: https://docs.nextcloud.com/server/latest/developer_manual/client_apis/LoginFlow/index.html#login-flow-v2
- *
*/
class Flow2Auth : public QObject
{
*/
void result(Flow2Auth::Result result, const QString &user = QString(), const QString &appPassword = QString());
+public slots:
+ void slotPollNow();
+
private slots:
void slotPollTimerTimeout();
ocWizard->account()->setCredentials(CredentialsFactory::create("http"));
_asyncAuth.reset(new Flow2Auth(ocWizard->account().data(), this));
connect(_asyncAuth.data(), &Flow2Auth::result, this, &Flow2AuthCredsPage::asyncAuthResult, Qt::QueuedConnection);
+ connect(this, &Flow2AuthCredsPage::pollNow, _asyncAuth.data(), &Flow2Auth::slotPollNow);
_asyncAuth->start();
// Don't hide the wizard (avoid user confusion)!
QApplication::clipboard()->setText(_asyncAuth->authorisationLink().toString(QUrl::FullyEncoded));
}
+void Flow2AuthCredsPage::slotPollNow()
+{
+ emit pollNow();
+}
+
} // namespace OCC
public Q_SLOTS:
void asyncAuthResult(Flow2Auth::Result, const QString &user, const QString &appPassword);
+ void slotPollNow();
signals:
void connectToOCUrl(const QString &);
+ void pollNow();
public:
QString _user;
connect(this, &OwncloudWizard::styleChanged, _advancedSetupPage, &OwncloudAdvancedSetupPage::slotStyleChanged);
customizeStyle();
+
+ // allow Flow2 page to poll on window activation
+ connect(this, &OwncloudWizard::onActivate, _flow2CredsPage, &Flow2AuthCredsPage::slotPollNow);
}
void OwncloudWizard::setAccount(AccountPtr account)
// Notify the other widgets (Dark-/Light-Mode switching)
emit styleChanged();
break;
+ case QEvent::ActivationChange:
+ if(isActiveWindow())
+ emit onActivate();
+ break;
default:
break;
}
void skipFolderConfiguration();
void needCertificate();
void styleChanged();
+ void onActivate();
protected:
void changeEvent(QEvent *) override;