From 3ccd6d3b4d01bc1f014816b4817de8154d347212 Mon Sep 17 00:00:00 2001 From: Joshua Goins Date: Thu, 24 Feb 2022 09:38:41 -0500 Subject: [PATCH] Don't load/save credentials from the system keychain in debug builds This prevents a really annoying workflow on macOS, wherein the system prompts you each time you rebuild the program. Closes #9 --- src/launcherwindow.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/launcherwindow.cpp b/src/launcherwindow.cpp index 2a6042f..1044f59 100644 --- a/src/launcherwindow.cpp +++ b/src/launcherwindow.cpp @@ -122,19 +122,23 @@ LauncherWindow::LauncherWindow(LauncherCore& core, QWidget* parent) : QMainWindo connect(core.assetUpdater, &AssetUpdater::finishedUpdating, [=] { auto info = LoginInformation{¤tProfile(), usernameEdit->text(), passwordEdit->text(), otpEdit->text()}; +#ifndef QT_DEBUG if(currentProfile().rememberUsername) { auto job = new QKeychain::WritePasswordJob("LauncherWindow"); job->setTextData(usernameEdit->text()); job->setKey(currentProfile().name + "-username"); job->start(); } +#endif +#ifndef QT_DEBUG if(currentProfile().rememberPassword) { auto job = new QKeychain::WritePasswordJob("LauncherWindow"); job->setTextData(passwordEdit->text()); job->setKey(currentProfile().name + "-password"); job->start(); } +#endif if(currentProfile().isSapphire) { this->core.sapphireLauncher->login(currentProfile().lobbyURL, info); @@ -196,6 +200,7 @@ void LauncherWindow::reloadControls() { } rememberUsernameBox->setChecked(currentProfile().rememberUsername); +#ifndef QT_DEBUG if(currentProfile().rememberUsername) { auto job = new QKeychain::ReadPasswordJob("LauncherWindow"); job->setKey(currentProfile().name + "-username"); @@ -205,8 +210,10 @@ void LauncherWindow::reloadControls() { usernameEdit->setText(job->textData()); }); } +#endif rememberPasswordBox->setChecked(currentProfile().rememberPassword); +#ifndef QT_DEBUG if(currentProfile().rememberPassword) { auto job = new QKeychain::ReadPasswordJob("LauncherWindow"); job->setKey(currentProfile().name + "-password"); @@ -216,6 +223,7 @@ void LauncherWindow::reloadControls() { passwordEdit->setText(job->textData()); }); } +#endif const bool canLogin = currentProfile().isSapphire || (!currentProfile().isSapphire && core.squareLauncher->isGateOpen);