summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Rettberg2022-05-25 15:23:07 +0200
committerSimon Rettberg2022-05-25 15:23:07 +0200
commit7149745e3a4fadc9a35b71cbdbad7db0db379f13 (patch)
tree004157e1738873236cfded0312f3d61d9c65f0d4
parentIncrease login timeout to 20 seconds (diff)
downloadslxgreeter-7149745e3a4fadc9a35b71cbdbad7db0db379f13.tar.gz
slxgreeter-7149745e3a4fadc9a35b71cbdbad7db0db379f13.tar.xz
slxgreeter-7149745e3a4fadc9a35b71cbdbad7db0db379f13.zip
Add user-session-enabled and shib-session-button-text
-rw-r--r--src/loginform.cpp18
-rw-r--r--src/settings.h2
2 files changed, 19 insertions, 1 deletions
diff --git a/src/loginform.cpp b/src/loginform.cpp
index fd2c52b..769c104 100644
--- a/src/loginform.cpp
+++ b/src/loginform.cpp
@@ -167,7 +167,9 @@ void LoginForm::initialize()
resetFormTimer.start(Settings::resetForm() * 1000);
}
+ int pageCount = 0;
if (Settings::guestSessionEnabled()) {
+ pageCount++;
if (!Settings::guestSessionButtonText().isEmpty()) {
ui->guestButton->setText(Settings::guestSessionButtonText());
}
@@ -188,6 +190,10 @@ void LoginForm::initialize()
}
if (Settings::shibSessionEnabled()) {
+ pageCount++;
+ if (!Settings::shibSessionButtonText().isEmpty()) {
+ ui->shibButton->setText(Settings::shibSessionButtonText());
+ }
connect(ui->shibButton, &QAbstractButton::released, this, [this]() {
if (browser == nullptr) {
browser = new WebView(ui->shibPage);
@@ -210,7 +216,13 @@ void LoginForm::initialize()
ui->shibButton->hide();
}
- if (Settings::guestSessionEnabled() || Settings::shibSessionEnabled()) {
+ if (Settings::userSessionEnabled()) {
+ pageCount++;
+ } else {
+ ui->loginButton->hide();
+ }
+
+ if (pageCount > 1) {
ui->loginChooser->setCurrentWidget(ui->welcomePage);
connect(ui->backButton, &QAbstractButton::released, this, [this]() {
resetForm();
@@ -226,6 +238,10 @@ void LoginForm::initialize()
ui->loginChooser->setCurrentWidget(ui->loginPage);
ui->userInput->setFocus();
});
+ } else if (Settings::shibSessionEnabled()) {
+ ui->loginChooser->setCurrentWidget(ui->shibPage);
+ } else if (Settings::guestSessionEnabled()) {
+ ui->loginChooser->setCurrentWidget(ui->guestPage);
} else {
ui->loginChooser->setCurrentWidget(ui->loginPage);
}
diff --git a/src/settings.h b/src/settings.h
index 2d6fb91..7542db1 100644
--- a/src/settings.h
+++ b/src/settings.h
@@ -44,9 +44,11 @@ public:
static QStringList clockShadow() { return s_settings->value("clock-shadow").toString().split(QRegExp("\\s"), QString::SkipEmptyParts); }
static QString usernamePlaceholder() { return s_settings->value("username-placeholder").toString(); }
static QString passwordPlaceholder() { return s_settings->value("password-placeholder").toString(); }
+ static bool userSessionEnabled() { return s_settings->value("user-session-enabled", "1").toBool(); }
static bool guestSessionEnabled() { return s_settings->value("guest-session-enabled").toBool(); }
static bool shibSessionEnabled() { return s_settings->value("shib-session-enabled").toBool(); }
static QString shibUrl() { return s_settings->value("shib-url").toString(); }
+ static QString shibSessionButtonText() { return s_settings->value("shib-session-button-text").toString(); }
static QString userSessionButtonText() { return s_settings->value("user-session-button-text").toString(); }
static QString guestSessionButtonText() { return s_settings->value("guest-session-button-text").toString(); }
static QString guestSessionStartText() { return s_settings->value("guest-session-start-text").toString(); }