mirror of
https://github.com/redstrate/Astra.git
synced 2025-04-23 12:57:45 +00:00
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
This commit is contained in:
parent
c3b331cf7e
commit
3ccd6d3b4d
1 changed files with 8 additions and 0 deletions
|
@ -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);
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue