diff options
author | Simon Rettberg | 2024-06-27 12:08:01 +0200 |
---|---|---|
committer | Simon Rettberg | 2024-06-27 12:08:01 +0200 |
commit | ff7c27147da6f8816c6aa1679101c22eab20544e (patch) | |
tree | 16d29a78f4780a40690213d3aa7c2d8b85a7dd96 /src | |
parent | Fix reading idp list file (diff) | |
download | slxgreeter-master.tar.gz slxgreeter-master.tar.xz slxgreeter-master.zip |
Diffstat (limited to 'src')
-rw-r--r-- | src/loginform.cpp | 6 | ||||
-rw-r--r-- | src/qrlogin.cpp | 1 | ||||
-rw-r--r-- | src/webview.cpp | 14 | ||||
-rw-r--r-- | src/webview.h | 2 |
4 files changed, 16 insertions, 7 deletions
diff --git a/src/loginform.cpp b/src/loginform.cpp index 3ca0ec4..e25bf8d 100644 --- a/src/loginform.cpp +++ b/src/loginform.cpp @@ -164,7 +164,7 @@ void LoginForm::initialize() if (Settings::resetForm() > 0) { connect(&resetFormTimer, &QTimer::timeout, [this]() { if (ui->loginChooser->currentWidget() == ui->qrPage) - return; + return; // Has own timeout logic int idleTime = static_cast<int>(getIdleTime(QX11Info::display())); int remaining = Settings::resetForm() * 1000 - idleTime; if (remaining <= 0) { @@ -532,11 +532,13 @@ void LoginForm::keyPressEvent(QKeyEvent *event) void LoginForm::resetForm() { - std::cerr << "PageCount: " << pageCount << std::endl; if (ui->loginChooser->currentWidget() == ui->qrPage && qrlogin != nullptr) { qrlogin->abort(); hideMessage(); } + if (ui->loginChooser->currentWidget() == ui->shibPage && browser != nullptr) { + browser->resetBrowserAndTimeout(); + } if (pageCount > 1) { ui->loginChooser->setCurrentWidget(ui->welcomePage); } diff --git a/src/qrlogin.cpp b/src/qrlogin.cpp index c562e98..26398ac 100644 --- a/src/qrlogin.cpp +++ b/src/qrlogin.cpp @@ -162,6 +162,7 @@ void QrLogin::handleAuthReceived(const QStringList &lines) } emit startAuthentication(lines[0], QLatin1String("shib=") + lines[1]); } else { + timer->stop(); emit triggerReset(QLatin1String("QR: Invalid reply received")); } } diff --git a/src/webview.cpp b/src/webview.cpp index 55443b3..745d700 100644 --- a/src/webview.cpp +++ b/src/webview.cpp @@ -62,13 +62,20 @@ WebView::WebView(QWidget* parent) connect(page(), SIGNAL(downloadRequested(QNetworkRequest)),this,SLOT(downloadRequest(QNetworkRequest))); connect(_timerAbortMessage, &QTimer::timeout, this, &WebView::downloadDeniedMessage); connect(_timerReset, &QTimer::timeout, this, [this]() { - this->stop(); - this->page()->mainFrame()->setContent(""); + this->resetBrowserAndTimeout(); emit triggerReset(tr("Inactivity Timeout")); }); connect(this, &QWebView::loadFinished, this, &WebView::onLoadFinished); } +void WebView::resetBrowserAndTimeout() +{ + _timerReset->stop(); + _timerAbortMessage->stop(); + this->stop(); + this->page()->mainFrame()->setContent(""); +} + void WebView::jsInjector(QWebFrame *frame) { QString str = Global::getCombinedIdpWhitelist().replace( @@ -201,9 +208,6 @@ void WebView::reset(const QString baseUrl) _firstLoad = true; _timerAbortMessage->stop(); _timerReset->stop(); - QTimer::singleShot(5000, [this]() { - _timerReset->stop(); - }); } static QRegularExpression urlListToRegExp(const QStringList &list) diff --git a/src/webview.h b/src/webview.h index 27ab2f7..48c0ceb 100644 --- a/src/webview.h +++ b/src/webview.h @@ -20,6 +20,8 @@ public: WebView(QWidget* parent = NULL); void reset(const QString baseUrl); + void resetBrowserAndTimeout(); + protected: QWebView *createWindow(QWebPage::WebWindowType) override; void mousePressEvent(QMouseEvent*) override; |