1
Fork 0
mirror of https://github.com/redstrate/Astra.git synced 2025-06-08 06:57:46 +00:00

Make the password field writeable again

This was previously disabled when you ticked "remember password" but I
ran into issues, let's try to make this work again in preparation for
0.6.0.
This commit is contained in:
Joshua Goins 2024-05-26 08:43:33 -04:00
parent 86d4fedb95
commit e94483af2a
2 changed files with 5 additions and 8 deletions

View file

@ -321,7 +321,7 @@ QCoro::Task<QString> Account::getKeychainValue(const QString &key)
co_await qCoro(job, &QKeychain::ReadPasswordJob::finished); co_await qCoro(job, &QKeychain::ReadPasswordJob::finished);
if (job->error() != QKeychain::NoError) { if (job->error() != QKeychain::NoError) {
qWarning(ASTRA_LOG) << "Error when reading" << key << job->errorString(); qWarning(ASTRA_LOG) << "Error when reading" << key << job->errorString() << "for account" << uuid();
} }
co_return job->textData(); co_return job->textData();

View file

@ -57,14 +57,11 @@ QQC2.Control {
return false; return false;
} }
if (LauncherCore.currentProfile.loggedIn) { return !LauncherCore.currentProfile.loggedIn;
return false;
}
return true;
} }
function updateFields() { function updateFields() {
console.info(!LauncherCore.currentProfile.account.needsPassword && LauncherCore.currentProfile.account.rememberPassword);
usernameField.text = LauncherCore.currentProfile.account.name; usernameField.text = LauncherCore.currentProfile.account.name;
passwordField.text = !LauncherCore.currentProfile.account.needsPassword && LauncherCore.currentProfile.account.rememberPassword ? LauncherCore.currentProfile.account.getPassword() : ""; passwordField.text = !LauncherCore.currentProfile.account.needsPassword && LauncherCore.currentProfile.account.rememberPassword ? LauncherCore.currentProfile.account.getPassword() : "";
otpField.text = ""; otpField.text = "";
@ -99,6 +96,8 @@ QQC2.Control {
} }
} }
Component.onCompleted: updateFields()
contentItem: ColumnLayout { contentItem: ColumnLayout {
width: parent.width width: parent.width
@ -236,7 +235,6 @@ QQC2.Control {
id: passwordField id: passwordField
label: LauncherCore.currentProfile.account.isSapphire ? i18n("Password") : i18n("Square Enix Password") label: LauncherCore.currentProfile.account.isSapphire ? i18n("Password") : i18n("Square Enix Password")
echoMode: TextInput.Password echoMode: TextInput.Password
enabled: LauncherCore.currentProfile.account.rememberPassword ? LauncherCore.currentProfile.account.needsPassword : true
focus: true focus: true
onAccepted: { onAccepted: {
if (otpField.visible) { if (otpField.visible) {
@ -245,7 +243,6 @@ QQC2.Control {
loginButton.clicked(); loginButton.clicked();
} }
} }
text: (!LauncherCore.currentProfile.account.needsPassword && LauncherCore.currentProfile.account.rememberPassword) ? LauncherCore.currentProfile.account.getPassword() : ""
} }
FormCard.FormDelegateSeparator { FormCard.FormDelegateSeparator {