Skip to content

Commit f1bfc1a

Browse files
authored
Merge pull request #10459 from nextcloud/bugfix/ReAuthDialog
fix(wizard): align reauthentication with account setup
2 parents dee0520 + d5a4b1b commit f1bfc1a

28 files changed

Lines changed: 1000 additions & 1299 deletions

resources.qrc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,9 @@
6363
<file>src/gui/wizard/qml/AccountWizardWindow.qml</file>
6464
<file>src/gui/wizard/qml/AdvancedOptionsDialog.qml</file>
6565
<file>src/gui/wizard/qml/BasicAuthPage.qml</file>
66+
<file>src/gui/wizard/qml/BrowserAuthFooter.qml</file>
6667
<file>src/gui/wizard/qml/BrowserAuthPage.qml</file>
68+
<file>src/gui/wizard/qml/BrowserReAuthWindow.qml</file>
6769
<file>src/gui/wizard/qml/ClientCertificateDialog.qml</file>
6870
<file>src/gui/wizard/qml/OptionRow.qml</file>
6971
<file>src/gui/wizard/qml/ProxySettingsDialog.qml</file>

src/3rdparty/QProgressIndicator/QProgressIndicator.cpp

Lines changed: 0 additions & 116 deletions
This file was deleted.

src/3rdparty/QProgressIndicator/QProgressIndicator.h

Lines changed: 0 additions & 92 deletions
This file was deleted.

src/3rdparty/QProgressIndicator/README.md

Lines changed: 0 additions & 18 deletions
This file was deleted.

src/gui/CMakeLists.txt

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@ set(client_UI_SRCS
5353
proxyauthdialog.ui
5454
mnemonicdialog.ui
5555
vfsdownloaderrordialog.ui
56-
wizard/flow2authwidget.ui
5756
)
5857

5958
qt_add_resources(client_UI_SRCS ../../resources.qrc ${CMAKE_SOURCE_DIR}/theme.qrc)
@@ -259,16 +258,12 @@ set(client_SRCS
259258
creds/flow2auth.cpp
260259
creds/webflowcredentials.h
261260
creds/webflowcredentials.cpp
262-
creds/webflowcredentialsdialog.h
263-
creds/webflowcredentialsdialog.cpp
264261
wizard/accountwizardcontroller.h
265262
wizard/accountwizardcontroller.cpp
266-
wizard/flow2authwidget.h
267-
wizard/flow2authwidget.cpp
268-
wizard/providersignuppage.h
269-
wizard/providersignuppage.cpp
270-
wizard/linklabel.h
271-
wizard/linklabel.cpp
263+
wizard/browserreauthcontroller.h
264+
wizard/browserreauthcontroller.cpp
265+
wizard/browserreauthwindow.h
266+
wizard/browserreauthwindow.cpp
272267
integration/fileactionsmodel.h
273268
integration/fileactionsmodel.cpp
274269
)
@@ -424,8 +419,6 @@ IF( APPLE )
424419
ENDIF()
425420

426421
set(3rdparty_SRC
427-
../3rdparty/QProgressIndicator/QProgressIndicator.h
428-
../3rdparty/QProgressIndicator/QProgressIndicator.cpp
429422
../3rdparty/kmessagewidget/kmessagewidget.h
430423
../3rdparty/kmessagewidget/kmessagewidget.cpp
431424
../3rdparty/kirigami/wheelhandler.h
@@ -625,7 +618,6 @@ set_target_properties(nextcloudCore
625618

626619
target_include_directories(nextcloudCore
627620
PUBLIC
628-
${CMAKE_SOURCE_DIR}/src/3rdparty/QProgressIndicator
629621
${CMAKE_SOURCE_DIR}/src/3rdparty/kirigami
630622
${CMAKE_SOURCE_DIR}/src/3rdparty/kmessagewidget
631623
${CMAKE_CURRENT_BINARY_DIR}

src/gui/WizardStyledWindow.qml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ import Style
1111
ApplicationWindow {
1212
id: root
1313

14+
property bool minimizable: false
15+
1416
LayoutMirroring.enabled: Application.layoutDirection === Qt.RightToLeft
1517
LayoutMirroring.childrenInherit: true
1618

@@ -19,6 +21,7 @@ ApplicationWindow {
1921
| Qt.WindowTitleHint
2022
| Qt.WindowSystemMenuHint
2123
| Qt.WindowCloseButtonHint
24+
| (root.minimizable ? Qt.WindowMinimizeButtonHint : 0)
2225
color: Style.wizardWindowBackground
2326
palette.window: Style.wizardWindowBackground
2427
palette.base: Style.wizardFieldBackground

src/gui/creds/webflowcredentials.cpp

Lines changed: 23 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,14 @@
1111
#include "account.h"
1212
#include "configfile.h"
1313
#include "theme.h"
14-
#include "webflowcredentialsdialog.h"
14+
#include "wizard/browserreauthwindow.h"
1515
#include "networkjobs.h"
1616

1717
#include <QAuthenticator>
1818
#include <QNetworkAccessManager>
1919
#include <QNetworkReply>
2020
#include <QPointer>
2121
#include <QTimer>
22-
#include <QDialog>
23-
#include <QVBoxLayout>
24-
#include <QLabel>
2522

2623
using namespace QKeychain;
2724

@@ -145,22 +142,31 @@ void WebFlowCredentials::fetchFromKeychain(const QString &appName) {
145142
}
146143

147144
void WebFlowCredentials::askFromUser() {
148-
_askDialog = new WebFlowCredentialsDialog(_account);
145+
if (_reAuthWindow) {
146+
_reAuthWindow->show();
147+
return;
148+
}
149+
150+
_reAuthWindow = new BrowserReAuthWindow(_account, this);
149151

150152
QString msg = tr("You have been logged out of your account %1 at %2. Please login again.")
151153
.arg(_account->prettyName(), _account->url().toDisplayString());
152-
_askDialog->setInfo(msg);
154+
_reAuthWindow->setInfoText(msg);
153155

154-
_askDialog->show();
156+
connect(_reAuthWindow, &BrowserReAuthWindow::credentialsReady, this, &WebFlowCredentials::slotAskFromUserCredentialsProvided);
157+
connect(_reAuthWindow, &BrowserReAuthWindow::cancelled, this, &WebFlowCredentials::slotAskFromUserCancelled);
155158

156-
connect(_askDialog, &WebFlowCredentialsDialog::urlCatched, this, &WebFlowCredentials::slotAskFromUserCredentialsProvided);
157-
connect(_askDialog, &WebFlowCredentialsDialog::onClose, this, &WebFlowCredentials::slotAskFromUserCancelled);
159+
_reAuthWindow->show();
158160

159161
qCDebug(lcWebFlowCredentials()) << "User needs to reauth!";
160162
}
161163

162-
void WebFlowCredentials::slotAskFromUserCredentialsProvided(const QString &user, const QString &pass, const QString &host) {
163-
Q_UNUSED(host)
164+
void WebFlowCredentials::slotAskFromUserCredentialsProvided(const QString &user, const QString &pass) {
165+
auto *const reAuthWindow = qobject_cast<BrowserReAuthWindow *>(sender());
166+
if (!reAuthWindow || reAuthWindow != _reAuthWindow) {
167+
return;
168+
}
169+
_reAuthWindow = nullptr;
164170

165171
qCInfo(lcWebFlowCredentials()) << "Obtained a new password";
166172

@@ -170,18 +176,18 @@ void WebFlowCredentials::slotAskFromUserCredentialsProvided(const QString &user,
170176
_credentialsValid = true;
171177
persist();
172178
emit asked();
173-
174-
_askDialog->close();
175-
_askDialog = nullptr;
176179
}
177180

178181
void WebFlowCredentials::slotAskFromUserCancelled() {
182+
auto *const reAuthWindow = qobject_cast<BrowserReAuthWindow *>(sender());
183+
if (!reAuthWindow || reAuthWindow != _reAuthWindow) {
184+
return;
185+
}
186+
_reAuthWindow = nullptr;
187+
179188
qCDebug(lcWebFlowCredentials()) << "User cancelled reauth!";
180189

181190
emit asked();
182-
183-
_askDialog->deleteLater();
184-
_askDialog = nullptr;
185191
}
186192

187193
bool WebFlowCredentials::stillValid(QNetworkReply *reply) {

0 commit comments

Comments
 (0)